Skip to content

feat: off-chain sync and async task infrastructure#87

Merged
anonfedora merged 2 commits intoFracverse:masterfrom
aji70:feature/offchain-sync-async-tasks
Feb 25, 2026
Merged

feat: off-chain sync and async task infrastructure#87
anonfedora merged 2 commits intoFracverse:masterfrom
aji70:feature/offchain-sync-async-tasks

Conversation

@aji70
Copy link
Contributor

@aji70 aji70 commented Feb 21, 2026

Off-chain sync and async task infrastructure

Ensures the off-chain database stays in sync with on-chain reality and handles asynchronous tasks (email/notifications).

Changes

EventBridgeService

  • Polls Soroban events and keeps DB state in sync
  • Handles PaymentSettled, PaymentFailed, PaymentInitiated
  • Configurable poll interval and error backoff (EVENT_BRIDGE_POLL_MS, EVENT_BRIDGE_ERROR_BACKOFF_MS)
  • Optional contract ID filtering via SOROBAN_CONTRACT_IDS
  • Deduplication and graceful shutdown

QueueService

JobProcessors

  • EmailProcessor – email send flow (SendGrid/SES integration-ready)
  • NotificationProcessor – stores notifications in DB and enqueues push (FCM-ready)
  • SyncProcessoruser_data, analytics, backup, on_chain_sync
  • BlockchainTxProcessor – simulates and submits XDR, updates Payment/Transfer status

All processors use structured logging and consistent error handling.

JobProcessorRegistry

  • Central mapping of job types to processor functions
  • Single worker entry point that resolves the processor via registry

Worker configuration

  • Configurable concurrency (WORKER_CONCURRENCY)
  • Retries with exponential backoff (JOB_MAX_RETRIES, JOB_BACKOFF_DELAY_MS)
  • Graceful shutdown on SIGINT/SIGTERM

New files

  • server/src/config/worker.config.ts
  • server/src/types/job-payloads.ts
  • server/src/processors/ – email, notification, sync, blockchain-tx, index (registry)
  • server/src/utils/soroban-events.ts

Environment variables

See server/.env.example for:

  • SOROBAN_CONTRACT_IDS
  • EVENT_BRIDGE_POLL_MS, EVENT_BRIDGE_ERROR_BACKOFF_MS
  • WORKER_CONCURRENCY, JOB_MAX_RETRIES, JOB_BACKOFF_DELAY_MS

@anonfedora anonfedora merged commit 18e9cf7 into Fracverse:master Feb 25, 2026
3 checks passed
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.

[WORKERS] On-Chain Event Bridge and Background Jobs

2 participants