This patch release hardens the FIFO subscriber loop to make production usage safer and more responsive.
✨ Highlights
-
Automatic roll-backs on all error paths
•fifoSubscriber.Startnow rolls back the transaction if box initialization, message processing, or commit fails – preventing dangling or locked DB transactions. -
Graceful shutdown & context awareness
• The main processing loop now checksctx.Done()on every iteration and during waits, exiting cleanly when the caller cancels the context.
•waithelper replacedtime.Sleepwith aselecton<-ctx.Done()to avoid hanging during shutdown. -
Context-aware waiting strategy
• The wait logic remains the same (different back-off when messages were/weren’t found) but can now be interrupted instantly on shutdown.
🐛 Fixes
- Eliminated potential resource leaks caused by un-rolled-back transactions.
- Removed noisy duplicate log lines when retrying after errors.
🔧 Internal
- Added
wait(ctx, cause, d)helper replacing the old blockingwait. - Incremented code coverage of edge cases in subscriber loop.
No breaking API changes – a recommended drop-in upgrade for all users.