Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix reminder frequency not getting sent daily when early by a few seconds/minutes #496

Merged
merged 3 commits into from
Aug 10, 2023

Conversation

nattsw
Copy link
Contributor

@nattsw nattsw commented Aug 8, 2023

t/105676

When a user sets their reminder frequency to be "daily", there's a chance that they actually only get it sent every two days.

(/my/preferences/notifications)
Screenshot 2023-08-08 at 7 50 15 PM

This is likely happening as our EnqueueReminders sidekiq job runs every 1.day, issuing a second job RemindUser which updates the last_reminded_at value to be a bit after the time when the sidekiq job gets done. The list of users to send reminders to depends on last_reminded_at being more than the user set reminder frequency, resulting in the bug that the reminder only triggers on the next day.

Comment on lines +51 to +61
it "enqueues a reminder if the user reminder frequency is 1 day and the last reminded at is almost 1 day" do
user.custom_fields[
PendingAssignsReminder::REMINDERS_FREQUENCY
] = RemindAssignsFrequencySiteSettings::DAILY_MINUTES
user.custom_fields[PendingAssignsReminder::REMINDED_AT] = 1.days.ago
user.save

assert_reminders_enqueued(1)
end
assign_multiple_tasks_to(user, assigned_on: 1.day.ago - 1.minute)

it "does not enqueue reminders if the remind frequency is set to never" do
SiteSetting.remind_assigns_frequency = 0
assign_multiple_tasks_to(user)
assert_reminders_enqueued(1)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Non-obvious, but this is the new test for the buffer.

Copy link
Contributor

@Drenmi Drenmi left a comment

Choose a reason for hiding this comment

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

🕙

@nattsw nattsw merged commit f5cc748 into main Aug 10, 2023
5 checks passed
@nattsw nattsw deleted the fix-reminder-email-frequency branch August 10, 2023 04:04
@nattsw
Copy link
Contributor Author

nattsw commented Aug 10, 2023

Thank you @Drenmi

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.

2 participants