audiobookshelf/server/libs/nodeCron/storage.js

19 lines
489 B
JavaScript
Raw Normal View History

2022-06-08 03:04:51 +02:00
module.exports = (() => {
if(!global.scheduledTasks){
global.scheduledTasks = new Map();
}
return {
save: (task) => {
if(!task.options){
const uuid = require('uuid');
task.options = {};
task.options.name = uuid.v4();
}
global.scheduledTasks.set(task.options.name, task);
},
getTasks: () => {
return global.scheduledTasks;
}
};
})();