- Notifications
You must be signed in to change notification settings - Fork927
feat: add notification deduplication trigger#14172
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -13,14 +13,15 @@ WHERE nt.id = @notification_template_id | |||
AND u.id = @user_id; | |||
-- name: EnqueueNotificationMessage :exec | |||
INSERT INTO notification_messages (id, notification_template_id, user_id, method, payload, targets, created_by) | |||
INSERT INTO notification_messages (id, notification_template_id, user_id, method, payload, targets, created_by, created_at) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I addedcreated_at
to be passed in to make the dedupe hash testable by using Quartz to advance the clock.
Signed-off-by: Danny Kopping <danny@coder.com>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Flagged some stuff but looks pretty straight-forward to me, approved.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Approving to unblock; previous comments still hold.
Signed-off-by: Danny Kopping <danny@coder.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Still LGTM 👍🏻
@@ -13,6 +13,8 @@ import ( | |||
"github.com/stretchr/testify/assert" | |||
"github.com/stretchr/testify/require" | |||
"github.com/coder/quartz" | |||
"github.com/coder/serpent" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Another instance of import grouping, this is the job of the tooling tbh (and it's failing), so up to you if you want to fix it 😄. (There are actually a few more of these too but I'll leave those uncommented.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'll leave this for now; we need the tooling to be updated as you suggest.
Thanks for pointing this out though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
9c8c6a9
intomainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Closescoder/internal#26
Maintains a deduplication hash for each
notification_message
entry on insert/update to prevent identical notifications from being enqueued on the same day.I plumbed in
coder/quartz
to help manipulate time to make theTestNotificationDuplicates
simple and readable.