Add debug info for PrAT expiry emails
What does this MR do and why?
Adds log messages to track which tokens are notified per-batch in PersonalAccessTokens::ExpiringWorker, so we can track if batches contain any duplicates.
Also restricts the query for updating notification_sent_at columns to ensure the pagination is consistent between the fetch and update queries.
Finally, keeps a record during each worker run of whether notification emails have been sent for a particular bot user + interval combo. If they have, skips that combo and logs the issue.
Introduces the pats_expiring_worker_extended_logging feature flag to control the extended logs added in this MR, since they could potentially by noisy.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Before | After |
|---|---|
How to set up and validate locally
The duplicate emails problem has been very difficult to reproduce locally.
Please see the new specs added for coverage of these exceptional scenarios.