Skip to content

BUGFIX: Keep workers out of reset() and fix stale writes of setup() - #17

Merged
bwaidelich merged 1 commit into
mainfrom
reset-status-fence
Nov 4, 2026
Merged

bwaidelich merged 1 commit into
mainfrom
reset-status-fence

Conversation

@bwaidelich

Copy link
Copy Markdown
Owner

setup() and reset() called findByCriteriaForUpdate() outside of a transaction, so workers kept running during their handlers. Events could be handled twice, and a stale position could be written back.

reset() now fences the subscriptions with the new status RESETTING in a short transaction and runs the handlers without a lock. A failing handler moves the subscription to ERROR. A subscription that is already RESETTING is refused unless force: true is passed.

setup() decides the status change by the freshly locked row. Both methods throw RecursiveCatchUpException if called during a catch-up of the same subscriptions.

`setup()` and `reset()` called `findByCriteriaForUpdate()` outside of a
transaction, so workers kept running during their handlers. Events could
be handled twice, and a stale position could be written back.

`reset()` now fences the subscriptions with the new status `RESETTING`
in a short transaction and runs the handlers without a lock. A failing
handler moves the subscription to `ERROR`. A subscription that is already
`RESETTING` is refused unless `force: true` is passed.

`setup()` decides the status change by the freshly locked row. Both
methods throw `RecursiveCatchUpException` if called during a catch-up of
the same subscriptions.
@bwaidelich
bwaidelich merged commit fd66369 into main Nov 4, 2026
5 checks passed
@bwaidelich
bwaidelich deleted the reset-status-fence branch November 4, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant