[437] [High] Replace Polling Sweeper with a Deadline-Scheduled Job Queue - #550
Merged
Conversation
Arm expire-intent and fill-window-expired at create, accept, and deadline extension, and keep a slower safety sweep for jobs the queue misses. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Goodnessukaigwe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…e-polling-sweeper-with-a-deadline-scheduled-job-queue # Conflicts: # .env.example # CHANGELOG.md # docs/runbooks/on-call.md # jest.config.js # package-lock.json # package.json # src/app.module.ts # src/common/stellar-signature.ts # src/config/configuration.ts # src/config/env.validation.ts # src/governance/governance.module.ts # src/intents/intents-sweeper.service.ts # src/intents/intents.gateway.spec.ts # src/intents/intents.gateway.ts # src/intents/intents.module.ts # src/intents/intents.service.shadow.spec.ts # src/intents/intents.service.spec.ts # src/intents/solver-intent-matcher.ts # src/intents/ws/connection-state.ts # src/metrics/metrics.service.ts # src/solvers/solvers.controller.ts # src/soroban/event-ingestion.service.ts # src/soroban/signer.service.spec.ts # src/soroban/solver-registry.service.spec.ts # src/soroban/soroban.controller.spec.ts # src/soroban/soroban.module.ts # src/soroban/soroban.service.ts # src/soroban/stellar-tx.service.spec.ts # src/soroban/stellar-tx.service.ts # src/soroban/tx-confirmation.service.ts # src/tokens/in-memory-tokens.repository.ts # src/tokens/tokens.service.ts # src/treasury/treasury.service.spec.ts # src/treasury/treasury.service.ts # test/jest-e2e.json
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.
Summary
expire-intentwhen an intent is created andfill-window-expiredwhen it is accepted or its fill deadline is extended, using the existing job queue (delayMsplus an idempotency key ofjob:intentId:deadline).SAFETY_SWEEP_INTERVAL_MS(default 5 minutes). Intents it still has to expire or slash incrementvortex_sweeper_safety_caught_total(steady state ~0).triggerManualSweepis unchanged.Closes #437
Problem
IntentsSweeperService.sweepscanned every open and accepted intent every 30 seconds. Expiry waited up to that interval, and the scan grew with intent volume.Solution
Deadline jobs are the primary path and fire at the deadline (p99 under 2s in the timer test). The safety sweep only catches jobs the queue did not run. Queue technology is unchanged:
JOBS_DRIVERis stillmemoryorbullmq(ADR 0002). ADR 0005 records the choice.Test plan
fill-window-expiredSIGUSR2/triggerManualSweepstill runs one sweepvortex_sweeper_safety_caught_totalstays at 0 when deadline jobs are runningMade with Cursor