Added possibility to enable / disable tasks.
This commit is contained in:
parent
8f8d78d1df
commit
53a0ecd366
7 changed files with 109 additions and 46 deletions
server/jobs
|
@ -35,20 +35,24 @@ angular.module('ffffng').factory('Scheduler', function ($injector, Logger, confi
|
|||
schedule: expr,
|
||||
job: job,
|
||||
runningSince: false,
|
||||
lastRunStarted: false
|
||||
lastRunStarted: false,
|
||||
state: 'idle',
|
||||
enabled: true
|
||||
};
|
||||
|
||||
task.run = function () {
|
||||
if (task.runningSince) {
|
||||
if (task.runningSince || !task.enabled) {
|
||||
// job is still running, skip execution
|
||||
return;
|
||||
}
|
||||
|
||||
task.runningSince = moment();
|
||||
task.lastRunStarted = task.runningSince;
|
||||
task.state = 'running';
|
||||
|
||||
job.run(function () {
|
||||
task.runningSince = false;
|
||||
task.state = 'idle';
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -65,7 +69,6 @@ angular.module('ffffng').factory('Scheduler', function ($injector, Logger, confi
|
|||
schedule('0 */1 * * * *', 'MailQueueJob');
|
||||
|
||||
if (config.client.monitoring.enabled) {
|
||||
schedule('* * * * * *', 'TestJob');
|
||||
schedule('30 */15 * * * *', 'NodeInformationRetrievalJob');
|
||||
schedule('45 */5 * * * *', 'MonitoringMailsSendingJob');
|
||||
schedule('0 0 3 * * *', 'NodeInformationCleanupJob'); // every night at 3:00
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue