Skip to content

Fix payouts notifications not delivering#5430

Merged
fetchfern merged 5 commits intomodrinth:mainfrom
isXander:fix/payouts-notifications
Feb 26, 2026
Merged

Fix payouts notifications not delivering#5430
fetchfern merged 5 commits intomodrinth:mainfrom
isXander:fix/payouts-notifications

Conversation

@isXander
Copy link
Contributor

@isXander isXander commented Feb 25, 2026

Fixes #5427

1. Fix the bug

Return the list of actually inserted notification IDs, after filters, so uninserted rows don't get referenced in a foreign key, causing an FK violation.

This FK violation rolls back the entire transaction, so payout email notifications always fail.

2. Add a test case

Add a test case to prevent regressions and demonstrate the problem in action without the fix applied.

3. Add migration to prevent bugged backlog being emptied (rolled back)

In the payouts_values_notifications table, there will be a HUGE backlog of notified = FALSE, one for every user with a payout, for every month this bug has existed (probably from implementation of payout notifications).

Once this bug is fixed, the backlog will be emptied. Resulting in tens of thousands of emails being sent for ancient payouts.
It would be emptied slowly, 200 every 6 hours.

So I added a migration to update stale payouts_values_notifications rows to notified = TRUE.

@isXander isXander marked this pull request as ready for review February 25, 2026 23:50
@isXander isXander force-pushed the fix/payouts-notifications branch from 422595e to 07350ac Compare February 26, 2026 00:00
@isXander isXander force-pushed the fix/payouts-notifications branch from 07350ac to 446f398 Compare February 26, 2026 00:02
@fetchfern fetchfern self-requested a review February 26, 2026 17:34
Copy link
Contributor

@fetchfern fetchfern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Due to infra constraints would rather keep that query out of migrations - we'll run it ourselves, otherwise LGTM

@isXander isXander requested a review from fetchfern February 26, 2026 17:48
@fetchfern fetchfern added this pull request to the merge queue Feb 26, 2026
Merged via the queue into modrinth:main with commit 6fba33d Feb 26, 2026
5 checks passed
@isXander isXander deleted the fix/payouts-notifications branch February 26, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Payout notifications fail to send in a majority of cases

2 participants