mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
fixed #2142 -- passing in cached (pre-required) redis module into socket.io so it uses the same redis module... why? who bloody knows.
This commit is contained in:
@@ -93,16 +93,10 @@
|
|||||||
|
|
||||||
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
|
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
|
||||||
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
||||||
cxn = redis.createClient(nconf.get('redis:host'));
|
cxn = redis.createClient(nconf.get('redis:host'), { auth_pass: nconf.get('redis:password') });
|
||||||
} else {
|
} else {
|
||||||
/* Else, connect over tcp/ip */
|
/* Else, connect over tcp/ip */
|
||||||
cxn = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'));
|
cxn = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'), { auth_pass: nconf.get('redis:password') });
|
||||||
}
|
|
||||||
|
|
||||||
if (nconf.get('redis:password')) {
|
|
||||||
cxn.auth(nconf.get('redis:password'));
|
|
||||||
} else {
|
|
||||||
winston.warn('You have no redis password setup!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cxn.on('error', function (err) {
|
cxn.on('error', function (err) {
|
||||||
|
|||||||
@@ -82,7 +82,10 @@ Sockets.init = function(server) {
|
|||||||
sub = database.connect(),
|
sub = database.connect(),
|
||||||
client = database.connect();
|
client = database.connect();
|
||||||
|
|
||||||
|
// "redis" property needs to be passed in as referenced here: https://github.com/Automattic/socket.io/issues/808
|
||||||
|
// Probably fixed in socket.IO 1.0
|
||||||
config.store = new RedisStore({
|
config.store = new RedisStore({
|
||||||
|
redis: require('redis'),
|
||||||
redisPub : pub,
|
redisPub : pub,
|
||||||
redisSub : sub,
|
redisSub : sub,
|
||||||
redisClient : client
|
redisClient : client
|
||||||
|
|||||||
Reference in New Issue
Block a user