Wrap stitch queue claim in a transaction to hold row locks
The SELECT FOR UPDATE SKIP LOCKED and the subsequent UPDATE of next_stitch_at now run inside a single transaction. Previously the row locks were released after the SELECT auto-committed, allowing another worker to claim the same rows before the UPDATE ran. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
---
|
||||
|
||||
Fixed a race condition in the stitch queue claim logic where the `SELECT FOR UPDATE SKIP LOCKED` row locks were released before the `next_stitch_at` bump, allowing multiple workers to claim the same entity. Both statements now run inside a single transaction.
|
||||
Reference in New Issue
Block a user