Skip to content

fix(backend): serialize indexer triggerPoll with activeBatch mutex (#843) - #1004

Open
TCROWN10 wants to merge 1 commit into
LabsCrypt:mainfrom
TCROWN10:fix/843-indexer-triggerpoll-mutex
Open

fix(backend): serialize indexer triggerPoll with activeBatch mutex (#843)#1004
TCROWN10 wants to merge 1 commit into
LabsCrypt:mainfrom
TCROWN10:fix/843-indexer-triggerpoll-mutex

Conversation

@TCROWN10

Copy link
Copy Markdown

Summary

  • Route both scheduled poll() and admin triggerPoll() through a shared runExclusive mutex so only one fetchAndProcessEvents runs at a time (soroban-event-worker.ts).
  • Register every batch on activeBatch so waitForDrain() (graceful shutdown) awaits replay work, not just scheduled polls.
  • Add regression tests that overlapping poll/triggerPoll never run concurrently and that waitForDrain waits for an in-flight triggerPoll.

Closes #843

Test plan

  • npx vitest run tests/soroban-event-worker.test.ts --coverage.enabled=false (11 passed)
  • Confirm admin replay + scheduled poll cannot overlap in a local indexer run
  • Confirm process shutdown waits for an in-flight replay batch

…pt#843)

Prevent concurrent poll/replay from overlapping fetchAndProcessEvents so cursor writes cannot regress, and make waitForDrain cover replay batches.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

[Backend] Indexer replay triggerPoll() bypasses the activeBatch mutex - concurrent poll/replay race and shutdown drain gap

1 participant