ffffng/server/jobs/OfflineNodesDeletionJob.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
637 B
TypeScript

import MonitoringService from "../services/monitoringService";
import Logger from "../logger";
export default {
name: 'OfflineNodesDeletionJob',
description: 'Delete nodes that are offline for more than 100 days.',
run: (): Promise<void> => {
return new Promise<void>((resolve, reject) => {
MonitoringService.deleteOfflineNodes((err: any): void => {
if (err) {
Logger.tag('nodes', 'delete-offline').error('Error deleting offline nodes:', err);
return reject(err);
}
resolve();
});
});
}
};