Skip to content

Replace SCAN-based outbox delete with reverse index in Redis store#186

Merged
andrewwormald merged 2 commits intomainfrom
fix/redis-delete-outbox-reverse-index
Mar 10, 2026
Merged

Replace SCAN-based outbox delete with reverse index in Redis store#186
andrewwormald merged 2 commits intomainfrom
fix/redis-delete-outbox-reverse-index

Conversation

@andrewwormald
Copy link
Copy Markdown
Collaborator

Problem

DeleteOutboxEvent uses SCAN to iterate all outbox keys, then runs a Lua script doing LRANGE 0 -1 on each. This is O(workflows * events) — it won't scale.

Why

The code itself had a TODO acknowledging this. As workflows and events grow, delete latency grows linearly and blocks the outbox consumer.

Fix

Add a reverse index (outbox-event-id -> outbox-key) written atomically in the store Lua script. DeleteOutboxEvent now does a single GET + targeted LREM.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

Warning

Rate limit exceeded

@andrewwormald has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26ae3299-6c73-466c-9b79-e5207172508d

📥 Commits

Reviewing files that changed from the base of the PR and between f4d926f and 8946426.

📒 Files selected for processing (2)
  • adapters/wredis/store.go
  • adapters/wredis/store_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/redis-delete-outbox-reverse-index

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@andrewwormald andrewwormald merged commit 5ddc857 into main Mar 10, 2026
9 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.

2 participants