Added indexed availability for deferred outbox work - #30691
Conversation
ref https://linear.app/ghost/issue/BER-3936/raise-mailgun-event-fetch-throughput-concurrent-paging-logs-api Let durable suppression cleanup select due retries without scanning deferred work, while preserving existing outbox rows and indexes.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
|
It looks like this PR contains a migration 👀 General requirements
Schema changes
Data changes
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 4m 43s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 3m 42s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 3m 19s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 4m 16s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 2m 59s | View ↗ |
nx run-many -t test:types -p ghost |
✅ Succeeded | 5s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | <1s | View ↗ |
nx run-many -t test:unit -p ghost |
✅ Succeeded | 36s | View ↗ |
Additional runs (4) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-09-10 17:46:08 UTC
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## jonatan-ber-3936-bounded-mailgun-fetching #30691 +/- ##
=============================================================================
+ Coverage 67.70% 67.72% +0.01%
=============================================================================
Files 1674 1674
Lines 60586 60586
Branches 10499 10499
=============================================================================
+ Hits 41017 41029 +12
+ Misses 17230 17222 -8
+ Partials 2339 2335 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

ref https://linear.app/ghost/issue/BER-3936/raise-mailgun-event-fetch-throughput-concurrent-paging-logs-api
Remote suppression cleanup needs durable retry scheduling so Mailgun delays do not hold up event ingestion. This is the schema foundation: it adds a nullable
outbox.available_attimestamp and an index for selecting due work within an event type and status.Existing rows receive NULL and their payloads are preserved. The migration uses idempotent nontransactional helpers and removes the dependent index before dropping the column on rollback. It adds no producer or worker; the following PR will commit local unsubscribe/complaint safety state with cleanup intents and process them with retries, lease recovery and shutdown draining. Keeping this foundation separate lets us review the database change on its own.
Stacked on #30690 as the next part of the ingestion performance stack. The schema has no logical dependency on prefetch or counter modes. Adding the index can still take time on an existing outbox; no claim is made from the small test database about production DDL duration.
Validation: schema integrity, Core/test types and focused lint pass. Manual MySQL CLI initialization, rollback to 6.63 and forward migration to 6.64 preserved an existing payload and verified the nullable field and index order; the temporary database was removed. SQLite up/up/down/down/up and all four migration integration tests pass. Five independent review passes found no high-confidence issues.
The full unit run is not green: unrelated untracked suites fail and the runner reports source-map parsing errors. A separate tracked-only run reported 8,687 passing tests but still exited with 64 source-map errors. The migration-specific checks above pass. The earlier full repository check also stops on 452 unrelated formatting files.