2016-05-21 17:06:24 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-05-24 16:40:57 +02:00
|
|
|
angular.module('ffffng').factory('MailQueueJob', function (MailService, Logger) {
|
2016-05-21 17:06:24 +02:00
|
|
|
return {
|
2016-06-21 14:55:02 +02:00
|
|
|
description: 'Send pending emails (up to 5 attempts in case of failures).',
|
|
|
|
|
2016-06-03 23:42:17 +02:00
|
|
|
run: function (callback) {
|
2016-05-21 17:06:24 +02:00
|
|
|
MailService.sendPendingMails(function (err) {
|
|
|
|
if (err) {
|
2016-05-24 16:40:57 +02:00
|
|
|
Logger.tag('mail', 'queue').error('Error sending pending mails:', err);
|
2016-05-21 17:06:24 +02:00
|
|
|
}
|
2016-06-03 23:42:17 +02:00
|
|
|
|
|
|
|
callback();
|
2016-05-21 17:06:24 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|