Creatorship notifications sometimes fail with Record Not Found error for Creatorship

Description

Our three creatorship notifications sometimes fail due to a possible race condition with Creatorships. (Note: The records do not appear to exist in the database, so it may be a case of people deleting works or accounts before the email is sent.)

If it’s easier to handle this as three separate issues, please feel free to break it apart.

To test, make sure you can still successfully add and invite co-creators as a regular user, and add co-creators as an archivist.

When this is deployed to production, we can check the Resque failures list and make sure we don’t see new instances of these error.

creatorship_notification

This error occasionally happens when a regular user adds (not invites) a co-creator:

creatorship_invitation

This error occasionally happens when a regular user invites a co-creator:

Note: There’s also a variation where the email fails because the User can’t be found. This might be resolved by the same fix; if not, please move to a new issue:

creatorship_notification_archivist

This error occasionally happens when an archivist adds a co-creator:

Assignee

Unassigned

Reporter

Sarken

Roadmap

Works

Priority

Medium

Affects versions

Fix versions

None

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9
Configure