make the globals const
This commit is contained in:
@@ -16,9 +16,8 @@ const apps = require('./apps.js'),
|
||||
safe = require('safetydance'),
|
||||
_ = require('underscore');
|
||||
|
||||
// appId -> { containerId, schedulerConfig (manifest), cronjobs }
|
||||
let gState = { };
|
||||
let gSuspendedAppIds = new Set(); // suspended because some apptask is running
|
||||
const gState = {}; // appId -> { containerId, schedulerConfig (manifest), cronjobs }
|
||||
const gSuspendedAppIds = new Set(); // suspended because some apptask is running
|
||||
|
||||
// TODO: this should probably also stop existing jobs to completely prevent race but the code is not re-entrant
|
||||
function suspendJobs(appId) {
|
||||
@@ -120,10 +119,9 @@ async function sync() {
|
||||
debug(`sync: removing jobs of ${appId}`);
|
||||
const [error] = await safe(stopJobs(appId, gState[appId]));
|
||||
if (error) debug(`sync: error stopping jobs of removed app ${appId}: ${error.message}`);
|
||||
delete gState[appId];
|
||||
}
|
||||
|
||||
gState = _.omit(gState, removedAppIds);
|
||||
|
||||
for (const app of allApps) {
|
||||
const appState = gState[app.id] || null;
|
||||
const schedulerConfig = apps.getSchedulerConfig(app);
|
||||
|
||||
Reference in New Issue
Block a user