ffffng/server/jobs/MonitoringMailsSendingJob.ts
baldo 8b8835e4ac Typescript migration:
* Refactoring of scheduler and jobs to use promises.
* Add "failed" state for tasks.
2020-04-08 23:41:04 +02:00

21 lines
704 B
TypeScript

import Logger from "../logger";
import MonitoringService from "../services/monitoringService";
export default {
name: 'MonitoringMailsSendingJob',
description: 'Sends monitoring emails depending on the monitoring state of nodes retrieved by the NodeInformationRetrievalJob.',
run: (): Promise<void> => {
return new Promise<void>((resolve, reject) => {
MonitoringService.sendMonitoringMails((err: any): void => {
if (err) {
Logger.tag('monitoring', 'mail-sending').error('Error sending monitoring mails:', err);
return reject(err);
}
resolve();
});
});
}
};