moving db.close into the parent module

v1.18.x
psychobunny 11 years ago
parent df5f3d185a
commit bba3df6802

@ -38,14 +38,14 @@
winston.error('Unable to initialize Level DB! Is Level DB installed? Error :' + err.message);
process.exit();
}
if (db) {
if(typeof callback === 'function') {
callback();
}
return;
}
}
db = levelup(nconf.get('level:database'), {
valueEncoding: 'json'
@ -77,6 +77,10 @@
}
};
module.close = function(callback) {
db.close(callback);
};
var helpers = {};
helpers.iterator = function(fn, keys, value, callback) {

@ -5,10 +5,6 @@ var nconf = require('nconf'),
module.exports = function(db, module) {
var helpers = module.helpers.level;
module.close = function(callback) {
db.close(callback);
};
module.searchIndex = function(key, content, id) {
// o.O

@ -45,7 +45,7 @@
winston.error('Unable to initialize MongoDB! Is MongoDB installed? Error :' + err.message);
process.exit();
}
mongoClient.connect('mongodb://'+ nconf.get('mongo:host') + ':' + nconf.get('mongo:port') + '/' + nconf.get('mongo:database'), function(err, _db) {
if(err) {
winston.error("NodeBB could not connect to your Mongo database. Mongo returned the following error: " + err.message);
@ -105,6 +105,11 @@
});
};
module.close = function() {
db.close();
};
var helpers = {};
helpers.findItem = function(data, key) {
if(!data) {

@ -4,10 +4,7 @@ var winston = require('winston');
module.exports = function(db, module) {
var helpers = module.helpers.mongo;
module.close = function() {
db.close();
};
module.searchIndex = function(key, content, id) {
var data = {

@ -101,5 +101,10 @@
callback();
}
};
module.close = function() {
redisClient.quit();
};
}(exports));

@ -1,10 +1,6 @@
"use strict";
module.exports = function(redisClient, module) {
module.close = function() {
redisClient.quit();
};
module.searchIndex = function(key, content, id) {
if (key === 'post') {
module.postSearch.index(content, id);

Loading…
Cancel
Save