What
Events are dispatched and the cursor is updated via separate, independent DB operations with no wrapping transaction. If the process crashes after dispatchEvent(eventN) but before cursor.flush(), the cursor is not updated in the database.
Why
On restart, the indexer re-fetches and re-processes all events since the last flush — potentially hundreds of events. While the upserts are idempotent (no data corruption), this wastes significant time and DB resources.
Scope
- Wrap event writes and cursor update in a single transaction
- Or accept the re-processing and document it
Acceptance Criteria
Technical Context
- File:
src/indexer/event-listener.ts, lines 108-113
What
Events are dispatched and the cursor is updated via separate, independent DB operations with no wrapping transaction. If the process crashes after
dispatchEvent(eventN)but beforecursor.flush(), the cursor is not updated in the database.Why
On restart, the indexer re-fetches and re-processes all events since the last flush — potentially hundreds of events. While the upserts are idempotent (no data corruption), this wastes significant time and DB resources.
Scope
Acceptance Criteria
Technical Context
src/indexer/event-listener.ts, lines 108-113