scheduler: fix crash when container already exists
This commit is contained in:
@@ -76,10 +76,10 @@ 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, container) {
|
||||
docker.createSubcontainer(app, containerName, [ '/bin/sh', '-c', cmd ], { } /* options */, function (error) {
|
||||
if (error && error.reason !== BoxError.ALREADY_EXISTS) return iteratorDone(error);
|
||||
|
||||
debug(`createJobs: ${taskName} (${app.fqdn}) will run in container ${container.id}`);
|
||||
debug(`createJobs: ${taskName} (${app.fqdn}) will run in container ${containerName}`);
|
||||
|
||||
var cronJob = new CronJob({
|
||||
cronTime: cronTime, // at this point, the pattern has been validated
|
||||
|
||||
Reference in New Issue
Block a user