mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
The four WHOOP resources are independent pg-boss queues that run concurrently for the same user, so the read-modify-write that merged one cursor key into the map and wrote it back could let a sibling's write clobber a just-advanced cursor. Replace it with a single jsonb_set UPDATE that merges in place under the row lock, and GREATEST so the shared last-synced instant only moves forward. The resource key is parameter-bound and asserted against the closed resource set before it reaches the JSON path.