fix(archive): skip rebuildDirectory when another worker holds the advisory lock (BIT-33539) #330

Merged
spark merged 1 commits from fix/BIT-33539-archive-rebuild-directory-pk-race into main 2026-12-04 13:32:30 +00:00
1 Commits
Author SHA1 Message Date
nelson-baptista 941688d2c9 fix(archive): skip rebuildDirectory when another worker holds the advisory lock (BIT-33539)
ci / typescript (push) Skipped
ci / rust (push) Skipped
ci / rust (pull_request) Successful in 4m1s
ci / typescript (pull_request) Successful in 10m53s
Two workers could pick the same due source from rebuildDue (the SELECT
has no locking), both call deleteMany + createMany in overlapping
transactions, and the second commit hit archive_team_sides_pkey with
P2002. Add pg_try_advisory_xact_lock(hashtext(sourceId)) at the start
of the transaction: the second worker skips instead of colliding.

Paperclip-Issue: BIT-33539
2026-12-04 13:20:12 +00:00