init cache in various out of process workers
This commit is contained in:
@@ -64,7 +64,10 @@ var NOOP_CALLBACK = function (error) { if (error) debug(error); };
|
||||
function initialize(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
database.initialize(callback);
|
||||
async.series([
|
||||
database.initialize,
|
||||
settings.initCache
|
||||
], callback);
|
||||
}
|
||||
|
||||
function debugApp(app) {
|
||||
|
||||
@@ -279,10 +279,6 @@ function restore(backupConfig, backupId, version, auditSource, callback) {
|
||||
setProgress.bind(null, 'restore', 'Downloading backup'),
|
||||
backups.restore.bind(null, backupConfig, backupId, (progress) => setProgress('restore', progress.message, NOOP_CALLBACK)),
|
||||
setProgress.bind(null, 'restore', 'Applying auto-configuration'),
|
||||
// currently, our suggested restore flow is after a dnsSetup. The dnSetup creates DKIM keys and updates the DNS
|
||||
// for this reason, we have to re-setup DNS after a restore so it has DKIm from the backup
|
||||
// Once we have a 100% IP based restore, we can skip this
|
||||
mail.setDnsRecords.bind(null, settings.adminDomain()),
|
||||
eventlog.add.bind(null, eventlog.ACTION_RESTORE, auditSource, { backupId }),
|
||||
], function (error) {
|
||||
gProvisionStatus.restore.active = false;
|
||||
|
||||
@@ -10,14 +10,19 @@ if (process.argv[2] === '--check') return console.log('OK');
|
||||
require('supererror')({ splatchError: true });
|
||||
|
||||
var assert = require('assert'),
|
||||
async = require('async'),
|
||||
backups = require('../backups.js'),
|
||||
database = require('../database.js'),
|
||||
debug = require('debug')('box:backupupload');
|
||||
debug = require('debug')('box:backupupload'),
|
||||
settings = require('../settings.js');
|
||||
|
||||
function initialize(callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
database.initialize(callback);
|
||||
async.series([
|
||||
database.initialize,
|
||||
settings.initCache
|
||||
], callback);
|
||||
}
|
||||
|
||||
// Main process starts here
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
require('supererror')({ splatchError: true });
|
||||
|
||||
var assert = require('assert'),
|
||||
async = require('async'),
|
||||
backups = require('./backups.js'),
|
||||
database = require('./database.js'),
|
||||
debug = require('debug')('box:taskworker'),
|
||||
domains = require('./domains.js'),
|
||||
reverseProxy = require('./reverseproxy.js'),
|
||||
settings = require('./settings.js'),
|
||||
tasks = require('./tasks.js'),
|
||||
updater = require('./updater.js');
|
||||
|
||||
@@ -33,10 +35,17 @@ process.on('SIGTERM', function () {
|
||||
assert.strictEqual(process.argv.length, 3, 'Pass the taskid as argument');
|
||||
const taskId = process.argv[2];
|
||||
|
||||
function initialize(callback) {
|
||||
async.series([
|
||||
database.initialize,
|
||||
settings.initCache
|
||||
], callback);
|
||||
}
|
||||
|
||||
// Main process starts here
|
||||
debug(`Staring task ${taskId}`);
|
||||
|
||||
database.initialize(function (error) {
|
||||
initialize(function (error) {
|
||||
if (error) return process.exit(50);
|
||||
|
||||
tasks.get(taskId, function (error, task) {
|
||||
|
||||
Reference in New Issue
Block a user