diff --git a/app/models/notifier.rb b/app/models/notifier.rb index 81e69ce07..24c1b3b4e 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -14,7 +14,8 @@ class Notifier def notify if should_notify? - recipients.map do |recipient| + # Processing recipients in order avoids deadlocks if notifications overlap. + recipients.sort_by(&:id).map do |recipient| Notification.create! user: recipient, source: source, creator: creator end end