Lock held across an await
The ledger’s mutex is held while the settlement call awaits the bank, so every other settlement waits on one slow request and a timeout there stalls the whole queue.
settle() takes the ledger lock on line 84 and keeps the guard alive across bank.confirm(…).await on line 88. The bank answers in 200 ms on a good day and 30 s when it times out.
While it waits, every other settlement in the process blocks on the same lock. Under load the queue backs up behind a single slow confirmation, and the health check, which reads the ledger too, starts failing.
Read what the call needs into locals, drop the guard before the await, and take the lock again only to write the result.