Skip to content

fix: prevent digest cooldown consumption when RESEND_API_KEY is missing#2433

Open
Sricharan106 wants to merge 1 commit into
Umbrella-io:mainfrom
Sricharan106:fix/email-cron
Open

fix: prevent digest cooldown consumption when RESEND_API_KEY is missing#2433
Sricharan106 wants to merge 1 commit into
Umbrella-io:mainfrom
Sricharan106:fix/email-cron

Conversation

@Sricharan106

Copy link
Copy Markdown

Summary

Fixes an issue where the weekly digest cron reported emails as successfully sent when RESEND_API_KEY was not configured. Previously, users were marked as having received a digest and entered the 6-day cooldown period despite no email being delivered.

Closes #2415


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

What Changed

  • Updated sendEmail() to distinguish between successfully sent and skipped emails when RESEND_API_KEY is not configured.
  • Prevented last_digest_sent_at from being updated for skipped emails.
  • Added separate tracking for skipped emails so they do not consume the weekly digest cooldown period.
  • Corrected cron response metrics to avoid reporting emails as sent when no delivery occurred.

How to Test

  1. Run the weekly digest cron with RESEND_API_KEY unset.
  2. Verify the cron completes without sending emails.
  3. Confirm users' last_digest_sent_at values are not updated and that skipped emails are reported separately.

Expected result:

  • No emails are sent.
  • Users are not placed into the cooldown window.
  • sentCount remains accurate.
  • Skipped deliveries are tracked separately.

Additional Context

Before this change, deployments without a configured Resend API key could report successful email delivery while silently preventing users from receiving future digests due to the cooldown mechanism. This fix ensures cooldown timestamps are only recorded after a real email delivery attempt succeeds.

@github-actions

Copy link
Copy Markdown

Thanks for your first PR on DevTrack! 🎉

A maintainer will review it within 48 hours. While you wait:

  • Make sure CI is passing (type-check + lint)
  • Double-check the PR description is filled out and the issue is linked
  • Feel free to ask questions in Discussions if you need help

If you find DevTrack useful, a ⭐ star on the repo is always appreciated — it helps the project grow and attract more contributors!

@github-actions github-actions Bot added the gssoc26 GSSoC 2026 contribution label Jun 14, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Umbrella-io — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@github-actions github-actions Bot added type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) labels Jun 14, 2026
@Sricharan106 Sricharan106 changed the title ix: prevent digest cooldown consumption when RESEND_API_KEY is missing fix: prevent digest cooldown consumption when RESEND_API_KEY is missing Jun 14, 2026
@Sricharan106

Copy link
Copy Markdown
Author

@Priyanshu-byte-coder can you review the pr when you got time

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

Labels

gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Weekly digest cron treats missing RESEND_API_KEY as a successful send, consuming the 6-day cooldown with no email sent

1 participant