Feat/on chain sync bg jobs#76
Merged
anonfedora merged 8 commits intoFracverse:masterfrom Feb 26, 2026
Merged
Conversation
Contributor
Author
|
@anonfedora please review |
Contributor
Author
|
@ONEONUORA please review |
1 similar comment
Contributor
Author
|
@ONEONUORA please review |
Collaborator
|
fix merge conflicts, please |
Collaborator
|
Hello, you still have conflicts |
Contributor
Author
|
anonfedora
approved these changes
Feb 26, 2026
Collaborator
|
Can you make the CI pass? |
…chain-sync-bg-jobs
anonfedora
approved these changes
Feb 26, 2026
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.
feat: On-Chain Sync & Background Jobs #65
Description
This PR implements durable background processing for blockchain events and notification deliveries to improve system scalability and reliability. It introduces a message queue-based architecture using BullMQ, an Event Bridge for Soroban RPC polling, and specialized Workers with exactly-once processing guarantees and retry mechanisms.
Key Changes
1. Queues and Workers
QueueService:email-queue: Handles email delivery jobs.push-queue: Handles push notifications.sync-queue: Handles critical payment synchronization (e.g., updating DB onPAY_DONE).blockchain-tx-queue: Handles outbound transaction submission.src/workers/index.tsto instantiate separate workers for each queue, improving concurrency control and separation of concerns.2. Event Bridge & Soroban Polling
EventBridgeServiceto poll Soroban contract events (PAY_DONE,TRANSFER_DONE) from the blockchain.getEventsmethod inSorobanServiceleveraging@stellar/stellar-sdkto fetch contract events.sync-queueinstead of directly updating the database, ensuring resilience against DB downtime.3. Reliability & Idempotency
Sync Workerimplements an idempotency check:PaymentorTransferis already marked asCOMPLETEDin the database.QueueService.Integration Points
prisma.payment.updateto mark payments asCOMPLETED..env) and a validSOROBAN_RPC_URL.How to Test
.envhas correctREDIS_HOST/PORT.verify_sync.tsscript (or manually dispatch aSYNCjob via Redis/BullMQ console).Processing SYNC job->Payment not found(if using dummy ID) orPayment marked as COMPLETED.pnpm devand check for "Event Bridge started" logs.Checklist
processSync.Related Issues
Closes #65