Skip to content

fix: add TTL cleanup for stale WebhookEvent records in cronWorker (#2647) - #2729

Open
tmdeveloper007 wants to merge 1 commit into
nisshchayarathi:mainfrom
tmdeveloper007:issue-2647-webhook-event-ttl
Open

fix: add TTL cleanup for stale WebhookEvent records in cronWorker (#2647)#2729
tmdeveloper007 wants to merge 1 commit into
nisshchayarathi:mainfrom
tmdeveloper007:issue-2647-webhook-event-ttl

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Description

Completed and DLQ WebhookEvent records accumulated indefinitely with no TTL or archival mechanism. In production, this causes unbounded database growth, degraded query performance, and increasing backup/restore times.

Fix

Add cleanupStaleWebhookEvents() to scripts/cronWorker.ts that purges completed and DLQ records older than WEBHOOK_EVENT_TTL_DAYS (default: 30 days, configurable via env var). The query uses the existing @@index([status, createdAt]) for efficient range scans.

Pending and processing records are intentionally retained.

Files Changed

  • scripts/cronWorker.ts

Related Issues

Completed and DLQ WebhookEvent records accumulated indefinitely with no TTL
or archival mechanism, causing unbounded database growth.

Fix: add cleanupStaleWebhookEvents() to cronWorker that purges completed
and DLQ records older than WEBHOOK_EVENT_TTL_DAYS (default 30 days).
Uses the existing @@index([status, createdAt]) for efficient range scans.
Configurable via WEBHOOK_EVENT_TTL_DAYS env var (issue nisshchayarathi#2647).
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Nisshchaya's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@tmdeveloper007, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1508bd1-e65d-460c-b4c1-ab2c39f64bf3

📥 Commits

Reviewing files that changed from the base of the PR and between 153f57d and 4af2ddb.

📒 Files selected for processing (1)
  • scripts/cronWorker.ts

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.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

🎉 Thanks for your contribution, @tmdeveloper007!

Your PR has passed our automated GSSoC quality checks. Here's a quick summary:

Check Status
PR description ✅ Provided
PR title ✅ Meaningful
Linked issue ✅ Found
Change size ✅ Looks good (29 lines across 1 file(s))

A maintainer will review your PR soon. Please be patient and available for feedback. 💪

GSSoC'26 automation · Maintainer: @nisshchayarathi

@tmdeveloper007

Copy link
Copy Markdown
Contributor Author

CI status note: the failing Lint and Type Check checks are pre-existing failures on the main branch (confirmed by checking recent main-branch workflow runs — they fail with the same errors). This PR does not introduce any new lint or type errors. The Worker Consistency verify failure is also pre-existing on main. These CI gates are blocked by upstream issues unrelated to this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSSoC'26 Part of GirlScript Summer of Code 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data Growth: WebhookEvent records accumulate indefinitely with no TTL or archival

1 participant