Skip to content

No transaction wrapping event writes + cursor update #11

Description

@DeFiVC

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

  • Event writes and cursor update are atomic
  • No re-processing window on crash

Technical Context

  • File: src/indexer/event-listener.ts, lines 108-113

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions