
mail: Fix endless notification email
Yobi was sending a notification email endlessly if it failed to delete the email from the sending queue. It may happen if the database is corrupted. Do not send the notification email if an exception was thrown when deleting it from the queue(notification_email table).
@2799c86c336e29fbebb4ab5f5a0afc24c0434065
--- app/models/NotificationMail.java
+++ app/models/NotificationMail.java
... | ... | @@ -139,10 +139,11 @@ |
139 | 139 |
.orderBy("notificationEvent.created ASC").findList(); |
140 | 140 |
|
141 | 141 |
for (NotificationMail mail: mails) { |
142 |
- if (mail.notificationEvent.resourceExists()) { |
|
143 |
- sendNotification(mail.notificationEvent); |
|
144 |
- } |
|
142 |
+ NotificationEvent event = mail.notificationEvent; |
|
145 | 143 |
mail.delete(); |
144 |
+ if (event.resourceExists()) { |
|
145 |
+ sendNotification(event); |
|
146 |
+ } |
|
146 | 147 |
} |
147 | 148 |
} |
148 | 149 |
}, |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?