mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
moving db selection into db.connect, where it should be
This commit is contained in:
@@ -63,17 +63,6 @@
|
||||
module.postSearch = reds.createSearch('nodebbpostsearch');
|
||||
module.topicSearch = reds.createSearch('nodebbtopicsearch');
|
||||
|
||||
var db = parseInt(nconf.get('redis:database'), 10);
|
||||
|
||||
if (db) {
|
||||
redisClient.select(db, function(error) {
|
||||
if(error) {
|
||||
winston.error("NodeBB could not connect to your Redis database. Redis returned the following error: " + error.message);
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
require('./redis/main')(redisClient, module);
|
||||
require('./redis/hash')(redisClient, module);
|
||||
require('./redis/sets')(redisClient, module);
|
||||
@@ -87,7 +76,7 @@
|
||||
|
||||
module.connect = function() {
|
||||
var redis_socket_or_host = nconf.get('redis:host'),
|
||||
cxn;
|
||||
cxn, dbIdx;
|
||||
|
||||
if (!redis) redis = require('redis');
|
||||
|
||||
@@ -103,6 +92,17 @@
|
||||
cxn.auth(nconf.get('redis:password'));
|
||||
}
|
||||
|
||||
dbIdx = parseInt(nconf.get('redis:database'), 10);
|
||||
if (dbIdx) {
|
||||
console.log('SELECTING dbIdxBBBBBB', dbIdx);
|
||||
cxn.select(dbIdx, function(error) {
|
||||
if(error) {
|
||||
winston.error("NodeBB could not connect to your Redis database. Redis returned the following error: " + error.message);
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cxn.on('error', function (err) {
|
||||
winston.error(err.stack);
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user