-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Move BadgeAchievements::SendEmailNotificationWorker to Sidekiq #5779
Move BadgeAchievements::SendEmailNotificationWorker to Sidekiq #5779
Conversation
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.
Looks good @atsmith813, just left a general comment.
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.
Thanks @atsmith813!
Your call if you want to incorporate this suggestion: https://github.com/thepracticaldev/dev.to/pull/5779/files#r371597928
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.
Need to update the callback otherwise this looks good!
@@ -32,7 +32,7 @@ def notify_recipient | |||
def send_email_notification |
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.
This is called in an after_create
callback, we need to update that to be after_create_commit
to ensure the record is in the db before we attempt to send a notification.
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.
Agree with @mstruve here. Although, it seems to me that this was a preexisting issue since we were enqueuing this with perform_later
before the call to save
from the after_create
had actually executed 😬
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.
@vaidehijoshi it was not an issue with DelayedJob bc the jobs were so delayed that by the time they ran the records were always committed to the db which is why we have to now switch a bunch of these now bc Sidekiq is way faster.
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.
Lol, what a happy (and slow) coincidence! Thanks for clarifying 👍
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.
@vaidehijoshi funnily enough we never encountered this issue because Delayed Job was too slow at picking up jobs. A concurrency error that wasn't because the client was too slow to trigger it :D
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.
That's entirely my bad, asleep at the wheel there 🙈Thanks for catching that!
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.
Thanks @atsmith813, looks great and thanks @mstruve for being on top of after_create
callbacks :D
What type of PR is this? (check all applicable)
Description
This creates a new
BadgeAchievements::SendEmailNotificationWorker
(spec included) and starts sending jobs to it. Once this is merged and deployed, I will open a second PR to remove the old job code and spec.Related Tickets & Documents
Added to documentation?