mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
initialize / shutdown dbs simultaneously
This commit is contained in:
@@ -5,6 +5,7 @@ var nconf = require('nconf'),
|
|||||||
secondaryDBConfig = nconf.get('secondary_database'),
|
secondaryDBConfig = nconf.get('secondary_database'),
|
||||||
secondaryModules = nconf.get('secondary_db_modules'),
|
secondaryModules = nconf.get('secondary_db_modules'),
|
||||||
winston = require('winston'),
|
winston = require('winston'),
|
||||||
|
async = require('async'),
|
||||||
|
|
||||||
ALLOWED_MODULES = ['hash', 'list', 'sets', 'sorted'];
|
ALLOWED_MODULES = ['hash', 'list', 'sets', 'sorted'];
|
||||||
|
|
||||||
@@ -23,6 +24,17 @@ function setupSecondaryDB() {
|
|||||||
primaryDB[module] = secondaryDB[module];
|
primaryDB[module] = secondaryDB[module];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var primaryDBinit = primaryDB.init,
|
||||||
|
primaryDBclose = primaryDB.close;
|
||||||
|
|
||||||
|
primaryDB.init = function(callback) {
|
||||||
|
async.parallel([primaryDBinit, secondaryDB.init], callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
primaryDB.close = function(callback) {
|
||||||
|
async.parallel([primaryDBclose, secondaryDB.close], callback);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user