Skip to content

fix(indexer): make event persistence atomic (#168) - #239

Open
edehvictor wants to merge 1 commit into
Cylo-Traders:masterfrom
edehvictor:fix/atomic-event-persistence-168
Open

fix(indexer): make event persistence atomic (#168)#239
edehvictor wants to merge 1 commit into
Cylo-Traders:masterfrom
edehvictor:fix/atomic-event-persistence-168

Conversation

@edehvictor

Copy link
Copy Markdown
Contributor

Closes #168

Changes

  • wrap the processed-event lookup, every domain handler write, and the final idempotency marker in one Prisma interactive transaction
  • thread the transaction-scoped Prisma client through all event handlers and shared user upserts
  • add a regression test that injects a mid-handler failure, verifies the staged investment is rolled back, and proves a later retry commits exactly once

Testing

  • npm test -- --runInBand — 10 suites, 118 tests passed
  • npm run build — passed
  • npx eslint "src/indexer/parsers/event-parser.service.ts" "src/indexer/parsers/event-parser.service.spec.ts" — passed
  • git diff --check — passed

Notes

  • Repository-wide ESLint on this Windows checkout reports pre-existing CRLF formatting errors in unchanged files; the two files changed by this PR pass the configured lint rules.

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] Event handlers aren't wrapped in a database transaction, so a partial failure creates a permanently un-retryable "poison pill" event

1 participant