Skip to content

v5.9.3: Defer job publication until application transaction commits

Choose a tag to compare

@thorewi thorewi released this 12 Oct 07:52
· 4 commits to master since this release
When a job is published within an active application database transaction, it must not be sent to the message broker immediately. Sending it too early could lead to a race condition where another consumer picks up the job before the data it relies on is committed to the database, causing the consumer to fail.

This change introduces a dedicated `appConnection` to `BackgroundQueue`, which represents the application's database connection. Publication is now conditionally deferred based on the transaction status of this `appConnection` (expected to be managed by `BackgroundQueueMiddleware`), ensuring data consistency by publishing only after the application transaction successfully commits.