fix: resolve database write collisions on StreamEvent and fix schema/syntax errors#994
Open
onajidavid87-web wants to merge 3 commits into
Open
fix: resolve database write collisions on StreamEvent and fix schema/syntax errors#994onajidavid87-web wants to merge 3 commits into
onajidavid87-web wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves critical database write collisions and unique constraint violations (P2002) occurring when the backend action controllers and the event indexer worker attempt to write the same blockchain event.
Key changes include:
.create()to.upsert()in withdraw, pause, and resume controllers, avoiding duplicate key collisions on@@unique([transactionHash, eventType]).SorobanEventWorkerto only skip events if a finished event (ledgerSequence > 0) is already present. This ensures placeholder events (whereledgerSequence = 0) are properly updated with real ledger details and stream amounts are incremented correctly.IndexerStatemodel declaration in the Prisma schema and resolved a syntax error in the SSE service's client handler.write-race.regression.test.ts) validating controller-vs-indexer write orders, updated existing controller/worker mocks, and configured vitest to skip integration tests gracefully when a local Postgres server is unavailable.Type of Change
Related Issues
Closes #831
Changes Made
Testing
Test Coverage
Test Steps
Breaking Changes
Breaking Changes:
Migration Guide:
Screenshots/Demo
Checklist
Additional Notes