Typescript migration:
* Refactoring of scheduler and jobs to use promises. * Add "failed" state for tasks.
This commit is contained in:
parent
5c0b5abf73
commit
8b8835e4ac
15 changed files with 251 additions and 192 deletions
22
server/jobs/NodeInformationRetrievalJob.ts
Normal file
22
server/jobs/NodeInformationRetrievalJob.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Logger from "../logger";
|
||||
import MonitoringService from "../services/monitoringService";
|
||||
|
||||
export default {
|
||||
name: 'NodeInformationRetrievalJob',
|
||||
description: 'Fetches the nodes.json and calculates and stores the monitoring / online status for registered nodes.',
|
||||
|
||||
run: (): Promise<void> => {
|
||||
return new Promise<void>(
|
||||
(resolve, reject) => {
|
||||
MonitoringService.retrieveNodeInformation((err: any): void => {
|
||||
if (err) {
|
||||
Logger.tag('monitoring', 'information-retrieval').error('Error retrieving node data:', err);
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue