fix: #9231, fix redis pubsub connection

regression from fdfbc90255
This commit is contained in:
Barış Soner Uşaklı
2021-01-31 12:37:28 -05:00
parent 3696a19970
commit 5bc1f5b4e8
5 changed files with 34 additions and 28 deletions

View File

@@ -16,7 +16,7 @@ const Namespaces = {};
const Sockets = module.exports;
Sockets.init = function (server) {
Sockets.init = async function (server) {
requireModules();
const SocketIO = require('socket.io').Server;
@@ -30,7 +30,8 @@ Sockets.init = function (server) {
// io.adapter(require('./single-host-cluster'));
// } else if (nconf.get('redis')) {
if (nconf.get('redis')) {
io.adapter(require('../database/redis').socketAdapter());
const adapter = await require('../database/redis').socketAdapter();
io.adapter(adapter);
} else {
winston.warn('clustering detected, you should setup redis!');
}