scheduler: stash the containerId in the state
the container id will change when the app is re-configured. in the future, maybe it's better to do this like sftp.rebuild()
This commit is contained in:
@@ -14,7 +14,7 @@ let apps = require('./apps.js'),
|
||||
docker = require('./docker.js'),
|
||||
_ = require('underscore');
|
||||
|
||||
// appId -> { schedulerConfig (manifest), cronjobs }
|
||||
// appId -> { containerId, schedulerConfig (manifest), cronjobs }
|
||||
var gState = { };
|
||||
|
||||
|
||||
@@ -124,7 +124,9 @@ function sync() {
|
||||
var schedulerConfig = app.manifest.addons ? app.manifest.addons.scheduler : null;
|
||||
|
||||
if (!appState && !schedulerConfig) return iteratorDone(); // nothing to do
|
||||
if (appState && _.isEqual(appState.schedulerConfig, schedulerConfig) && appState.cronJobs) return iteratorDone(); // nothing changed
|
||||
if (appState && appState.cronJobs) { // we had created jobs for this app previously
|
||||
if (_.isEqual(appState.schedulerConfig, schedulerConfig) && appState.containerId === app.containerId) return iteratorDone(); // nothing changed
|
||||
}
|
||||
|
||||
debug(`sync: adding jobs of ${app.id}`);
|
||||
|
||||
@@ -139,7 +141,7 @@ function sync() {
|
||||
createJobs(app, schedulerConfig, function (error, cronJobs) {
|
||||
if (error) return iteratorDone(error); // if docker is down, the next sync() will recreate everything for this app
|
||||
|
||||
gState[app.id] = { schedulerConfig, cronJobs };
|
||||
gState[app.id] = { containerId: app.containerId, schedulerConfig, cronJobs };
|
||||
|
||||
iteratorDone();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user