Add some debug information

This commit is contained in:
Girish Ramakrishnan
2020-09-01 11:14:29 -07:00
parent c26dda7cc9
commit 5adfa722d4
2 changed files with 6 additions and 4 deletions

View File

@@ -61,9 +61,11 @@ function createJobs(app, schedulerConfig, callback) {
// stopJobs only deletes jobs since previous run. This means that when box code restarts, none of the containers
// are removed. The deleteContainer here ensures we re-create the cron containers with the latest config
docker.deleteContainer(containerName, function ( /* ignoredError */) {
docker.createSubcontainer(app, containerName, [ '/bin/sh', '-c', cmd ], { } /* options */, function (error) {
docker.createSubcontainer(app, containerName, [ '/bin/sh', '-c', cmd ], { } /* options */, function (error, container) {
if (error && error.reason !== BoxError.ALREADY_EXISTS) return iteratorDone(error);
debug(`createJobs: ${taskName} will run in container ${container.id}`);
var cronJob = new CronJob({
cronTime: cronTime, // at this point, the pattern has been validated
onTick: () => runTask(appId, taskName, (error) => { // put the app id in closure, so we don't use the outdated app object by mistake
@@ -143,7 +145,7 @@ function sync() {
});
});
}, function (error) {
if (error) return debug('sync: error creating jobs', error);
if (error) return debug('sync: error creating jobs', error.message);
});
});
});