DEV: Increase the buffer used to determine whether to send out the reminder email (#499)

Increase the buffer used to determine whether to send out the reminder email
This commit is contained in:
Natalie Tay 2023-08-15 14:12:10 +08:00 committed by GitHub
parent f5cc748986
commit 55f8d24b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -20,7 +20,7 @@ module Jobs
Group.assign_allowed_groups.pluck(:id).join(",")
end
REMINDER_BUFFER_MINUTES = 10
REMINDER_BUFFER_MINUTES = 120
def user_ids
global_frequency = SiteSetting.remind_assigns_frequency

View File

@ -52,16 +52,20 @@ RSpec.describe Jobs::EnqueueReminders do
user.custom_fields[
PendingAssignsReminder::REMINDERS_FREQUENCY
] = RemindAssignsFrequencySiteSettings::DAILY_MINUTES
user.custom_fields[PendingAssignsReminder::REMINDED_AT] = 1.days.ago
user.custom_fields[PendingAssignsReminder::REMINDED_AT] = 1.days.ago +
(Jobs::EnqueueReminders::REMINDER_BUFFER_MINUTES - 1)
user.save
assign_multiple_tasks_to(user, assigned_on: 1.day.ago - 1.minute)
assign_multiple_tasks_to(user, assigned_on: 2.day.ago)
assert_reminders_enqueued(1)
end
it "does not enqueue a reminder if it's too soon" do
user.upsert_custom_fields(PendingAssignsReminder::REMINDED_AT => 1.days.ago)
user.upsert_custom_fields(
PendingAssignsReminder::REMINDED_AT =>
1.days.ago + Jobs::EnqueueReminders::REMINDER_BUFFER_MINUTES,
)
assign_multiple_tasks_to(user)
assert_reminders_enqueued(0)