Add emails to Resque mailer queue after commit

Description

Now that the PR for has added the gem after_commit_everywhere, it'd be nice to reduce the number of email job failures in Resque by making as many emails as possible be sent after commit, to ensure that they won't be trying to look up information from the database before it's been committed.

Testing Instructions: The particular emails that need to be checked will depend on the PR, but will probably include most of the following:

  1. Notifications about comments sent to the work's creators.

  2. Notifications about comments on admin posts.

  3. Notifications about replies to logged-out users' comments.

  4. Notifications about replies to logged-in users' comments.

  5. Notifications about comment edits.

  6. Gift notifications on posting.

  7. Gift notifications on reveals.

  8. Notifications about fulfilling a claimed prompt on posting.

  9. Notifications about fulfilling a claimed prompt on reveals.

  10. Related work notifications (though beware of and ).

Activity

Show:
Sarken
June 5, 2020, 6:07 AM
  1. Notifications about comments sent to the work's creators. Comments from logged in users and guests both made it to my email address.

  2. Notifications about comments on admin posts. Left comment on news post as logged in user, checked the mailing list for these emails, and the comment notification was there.

  3. Notifications about replies to logged-out users' comments. A reply to a guest from a logged in user arrived in my email.

  4. Notifications about replies to logged-in users' comments. A reply to a logged in user from a guest arrived in my email.

  5. Notifications about comment edits. Edited comment notification for a comment on my work made it to my email.

  6. Gift notifications on posting. Posted a new work as a gift, got the notification.

  7. Gift notifications on reveals. Posted a gift work to an unrevealed collection. Recip got gift notification email when collection was revealed.

  8. Notifications about fulfilling a claimed prompt on posting. Claimed a prompt. Posted a fill to the revealed collection and prompter immediately got email.

  9. Notifications about fulfilling a claimed prompt on reveals. Claimed a prompt. Posted a fill to the unrevealed collection. Revealed collection. Got “A Response to your Prompt” email.

  10. Related work notifications Edited a work and added a parent work. Didn’t get an email, presumably because of existing bugs. Posted a new work and added a parent work. Again, no email. Tried a third time, this time with a different user’s work (I do have access to that email address), still no email. Gave it one more shot, this time previewing the work before posting, and I got the email (actually, two emails, because it was a co-created work and I own both accounts). I don’t see any errors in Resque or New Relic for the emails I didn’t get, so I assume everything is okay.

ticking instant
June 9, 2020, 12:13 AM

The issues with related work notifications seem consistent with the discussion in AO3-2373. There’s a comment about the notifications only being sent out if you preview before posting.

Rebecca Sentance
June 15, 2020, 9:55 AM
Edited

I tested everything except the reveals/prompt-related emails. Results:

  1. Received emails about comments from both logged-in users and guests

  2. mumble confirmed that a comment I left on a news post made it to the mailing list

  3. Got an email notification about a reply to a guest from a logged-in user

  4. Got an email notification about a reply to a logged-in user from a guest

  5. Received an email notification for an edited comment on my work

  6. Recevied an email notification for a new gift work posted by Testy

10. Testy created a new work inspired by one of my works, and no email notification was sent to my inbox. I tried again with testy2 and this time previewed the work before posting (per sarken and ticking instant’s comments) - successfully received an email notification for it.

Assignee

ticking instant

Reporter

ticking instant

Roadmap

Challenges
Collections
Comments
Works

Priority

High

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9
Configure