Skip to content

[Backend] PAUSED/RESUMED worker handlers skip the dedup guard used by all other events #543

@ogazboiz

Description

@ogazboiz

Telegram: https://t.me/+DOylgFv1jyJlNzM0

Why this matters

In backend/src/workers/soroban-event-worker.ts, every event handler (handleStreamCreated, handleTokensWithdrawn, handleFeeCollected, etc.) checks tx.streamEvent.findUnique({ where: { transactionHash_eventType } }) and skips/upserts to avoid duplicates on replay. But handleStreamPaused and handleStreamResumed call tx.streamEvent.create(...) directly with no dedup guard.

Given the @@unique([transactionHash, eventType]) constraint in schema.prisma, a replay (/v1/admin/indexer/replay) of a ledger containing a pause/resume will throw a unique-constraint error mid-transaction for those handlers, which is inconsistent with the restart-safe behaviour of the rest of the worker (#381).

Acceptance criteria

  • Make handleStreamPaused and handleStreamResumed use the same find-then-upsert-with-skip pattern as the other handlers
  • Add/extend a worker test that replays a pause+resume and asserts no duplicate rows and no thrown error

Files to touch

  • backend/src/workers/soroban-event-worker.ts (handleStreamPaused, handleStreamResumed)

Out of scope

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related tasksbugSomething isn't workingindexerBlockchain data indexing

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions