fix: check backfill table before Redis so it can override stuck queue…#937
fix: check backfill table before Redis so it can override stuck queue…#9370xFirekeeper merged 3 commits intomainfrom
Conversation
…d transactions Previously the backfill lookup only ran when a transaction was missing from Redis. Orphaned "queued" transactions that still exist in Redis were unreachable by backfill. Moving the check first lets backfill entries act as intentional overrides for stuck queue IDs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Same change as status endpoint — backfill entries should take priority over stale Redis data for consistency across all endpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughWhen Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant Route as Route Handler
participant Backfill as TransactionDB.getBackfill
participant Primary as TransactionDB.get
participant Redis as Redis (optional)
Client->>Route: request (queueId)
Route->>Backfill: getBackfill(queueId)
alt backfill exists && status == "mined" && valid hash
Backfill-->>Route: backfill record (mined, hash)
Route-->>Client: return backfill response
else no usable backfill
Route->>Primary: get(queueId)
alt primary has data
Primary-->>Route: transaction record (may include hash)
Route-->>Redis: (existing primary/redis lookup flow)
Route-->>Client: return primary response
else not found
Primary-->>Route: not found
Route-->>Client: return TRANSACTION_NOT_FOUND error
end
end
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/server/routes/transaction/blockchain/get-logs.ts`:
- Around line 161-173: The current logic falls back to
TransactionDB.get(queueId) whenever hash is falsy, which still allows fallback
when a backfill entry exists but is non-mined/errored; change the fallback to
only call TransactionDB.get when there is no backfill entry at all.
Specifically, after calling TransactionDB.getBackfill(queueId)
(env.ENABLE_TX_BACKFILL_FALLBACK and TransactionDB.getBackfill), treat the
presence of a backfill (even if non-mined) as authoritative and only run the
TransactionDB.get(queueId) path when backfill is null/undefined; keep the
existing mined-status check for backfill (backfill?.status === "mined") that
sets hash.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 28f49474-36f0-4508-abc1-eeee1c3709e1
📒 Files selected for processing (2)
src/server/routes/transaction/blockchain/get-logs.tssrc/server/routes/transaction/status.ts
When a backfill entry exists (even if errored), skip the Redis lookup entirely. Previously an errored backfill entry would fall through to Redis, potentially returning stale data for an orphaned transaction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d transactions
Previously the backfill lookup only ran when a transaction was missing from Redis. Orphaned "queued" transactions that still exist in Redis were unreachable by backfill. Moving the check first lets backfill entries act as intentional overrides for stuck queue IDs.
Changes
How this PR will be tested
Output
(Example: Screenshot/GIF for UI changes, cURL output for API changes)
PR-Codex overview
This PR enhances the transaction retrieval logic by prioritizing backfill entries for transactions that may not have received webhooks, particularly for AMEX. It simplifies the handling of transaction statuses and reduces redundancy in the code.
Detailed summary
Summary by CodeRabbit