more debug() removal
This commit is contained in:
+1
-14
@@ -23,8 +23,6 @@ function sync(callback) {
|
|||||||
|
|
||||||
callback = callback || NOOP_CALLBACK;
|
callback = callback || NOOP_CALLBACK;
|
||||||
|
|
||||||
debug('sync: synchronizing global state with installed app state');
|
|
||||||
|
|
||||||
apps.getAll(function (error, allApps) {
|
apps.getAll(function (error, allApps) {
|
||||||
if (error) return callback(error);
|
if (error) return callback(error);
|
||||||
|
|
||||||
@@ -67,8 +65,6 @@ function sync(callback) {
|
|||||||
iteratorDone();
|
iteratorDone();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
debug('sync: done');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -92,8 +88,6 @@ function stopJobs(appId, appState, callback) {
|
|||||||
assert.strictEqual(typeof appState, 'object');
|
assert.strictEqual(typeof appState, 'object');
|
||||||
assert.strictEqual(typeof callback, 'function');
|
assert.strictEqual(typeof callback, 'function');
|
||||||
|
|
||||||
debug(`stopJobs: stopping jobs of ${appId}`);
|
|
||||||
|
|
||||||
if (!appState) return callback();
|
if (!appState) return callback();
|
||||||
|
|
||||||
async.eachSeries(Object.keys(appState.schedulerConfig), function (taskName, iteratorDone) {
|
async.eachSeries(Object.keys(appState.schedulerConfig), function (taskName, iteratorDone) {
|
||||||
@@ -109,8 +103,6 @@ function createCronJobs(app, schedulerConfig) {
|
|||||||
assert.strictEqual(typeof app, 'object');
|
assert.strictEqual(typeof app, 'object');
|
||||||
assert(schedulerConfig && typeof schedulerConfig === 'object');
|
assert(schedulerConfig && typeof schedulerConfig === 'object');
|
||||||
|
|
||||||
debug(`createCronJobs: creating cron jobs for app ${app.fqdn}`);
|
|
||||||
|
|
||||||
var jobs = { };
|
var jobs = { };
|
||||||
|
|
||||||
Object.keys(schedulerConfig).forEach(function (taskName) {
|
Object.keys(schedulerConfig).forEach(function (taskName) {
|
||||||
@@ -120,8 +112,6 @@ function createCronJobs(app, schedulerConfig) {
|
|||||||
|
|
||||||
var cronTime = (constants.TEST ? '*/5 ' : `${randomSecond} `) + task.schedule; // time ticks faster in tests
|
var cronTime = (constants.TEST ? '*/5 ' : `${randomSecond} `) + task.schedule; // time ticks faster in tests
|
||||||
|
|
||||||
debug(`createCronJobs: ${app.fqdn} task ${taskName} scheduled at ${cronTime} with cmd ${task.command}`);
|
|
||||||
|
|
||||||
var cronJob = new CronJob({
|
var cronJob = new CronJob({
|
||||||
cronTime: cronTime, // at this point, the pattern has been validated
|
cronTime: cronTime, // at this point, the pattern has been validated
|
||||||
onTick: runTask.bind(null, app.id, taskName), // put the app id in closure, so we don't use the outdated app object by mistake
|
onTick: runTask.bind(null, app.id, taskName), // put the app id in closure, so we don't use the outdated app object by mistake
|
||||||
@@ -156,10 +146,7 @@ function runTask(appId, taskName, callback) {
|
|||||||
docker.inspectByName(containerName, function (err, data) {
|
docker.inspectByName(containerName, function (err, data) {
|
||||||
if (!err && data && data.State.Running === true) {
|
if (!err && data && data.State.Running === true) {
|
||||||
const jobStartTime = new Date(data.State.StartedAt); // iso 8601
|
const jobStartTime = new Date(data.State.StartedAt); // iso 8601
|
||||||
if (new Date() - jobStartTime < JOB_MAX_TIME) {
|
if (new Date() - jobStartTime < JOB_MAX_TIME) return callback();
|
||||||
debug(`runTask: skipped task ${taskName} of app ${app.fqdn} since it was started at ${jobStartTime}`);
|
|
||||||
return callback();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
killContainer(containerName, function (error) {
|
killContainer(containerName, function (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user