When the mod-finance-storage API is used to update 2 transactions at the same time, budget updates can run in parallel and result in incorrect budget values.
Steps to Reproduce:
- Run the integration test delete-opened-order-and-lines
Most of the time this results in a failure. Either the budget is wrong or a separate issue, "All expected transactions already processed", occurs (see
MODORDERS-539's implementation for mod-orders deletes 2 transactions of the deleted order line at the same time. mod-finance releases an encumbrance before deleting it. To release and delete, mod-finance calls mod-finance-storage. mod-finance-storage's budget update (EncumbranceService#updateBudgetsTotals) is not checking if another update is taking place in parallel.
A workaround for this issue was implemented in
The budget conflicts will be resolved by
MODFISTO-304. After that, MODFISTO-260 and related stories will fix processing transactions for the same order/invoice. Then, in the scope of this ticket, we can try to revert MODORDERS-582. If it works then this issue is resolved.