mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Only log the first skipped email when user exceeds daily limit.
https://meta.discourse.org/t/cleaning-up-e-mail-logs/39132
This commit is contained in:
@@ -126,8 +126,15 @@ describe Jobs::NotifyMailingListSubscribers do
|
||||
mailing_list_user.email_logs.create(email_type: 'foobar', to_address: mailing_list_user.email)
|
||||
}
|
||||
|
||||
Jobs::NotifyMailingListSubscribers.new.execute(post_id: post.id)
|
||||
UserNotifications.expects(:mailing_list_notify).with(mailing_list_user, post).never
|
||||
expect do
|
||||
UserNotifications.expects(:mailing_list_notify)
|
||||
.with(mailing_list_user, post)
|
||||
.never
|
||||
|
||||
2.times do
|
||||
Jobs::NotifyMailingListSubscribers.new.execute(post_id: post.id)
|
||||
end
|
||||
end.to change { SkippedEmailLog.count }.by(1)
|
||||
|
||||
expect(SkippedEmailLog.exists?(
|
||||
email_type: "mailing_list",
|
||||
|
||||
Reference in New Issue
Block a user