Repository navigation
Commit 482952f
fix(queue): lease messages with FOR UPDATE SKIP LOCKED so two readers never share one
Queue.read() selected the visible candidates and then bumped their vt in a
second statement. On libSQL the single multiplexed connection and the
in-process write lock serialised readers, so that was safe; on the Postgres
pool (#239) two concurrent readers see the same candidates and both lease
them. The integration test 'never hands the same message to two readers'
failed against a real Postgres (36 leases of 10 messages). The select now
locks the rows it is about to lease and skips rows another reader holds.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent a346d14 commit 482952f
1 file changed
Lines changed: 2 additions & 1 deletion
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
0 commit comments