|
@@ -148,21 +148,15 @@ class _IOModule extends CoreClass {
|
|
|
1,
|
|
|
(id, next) => {
|
|
|
const { session } = ns.connected[id];
|
|
|
- CacheModule.runJob(
|
|
|
- "HGET",
|
|
|
- {
|
|
|
- table: "sessions",
|
|
|
- key: session.sessionId
|
|
|
- },
|
|
|
- this
|
|
|
- )
|
|
|
- .then(session => {
|
|
|
- if (session && session.userId === payload.userId) sockets.push(ns.connected[id]);
|
|
|
- next();
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- next(err);
|
|
|
- });
|
|
|
+
|
|
|
+ if (session.sessionId) {
|
|
|
+ CacheModule.runJob("HGET", { table: "sessions", key: session.sessionId }, this)
|
|
|
+ .then(session => {
|
|
|
+ if (session && session.userId === payload.userId) sockets.push(ns.connected[id]);
|
|
|
+ next();
|
|
|
+ })
|
|
|
+ .catch(err => next(err));
|
|
|
+ } else next();
|
|
|
},
|
|
|
err => {
|
|
|
if (err) return reject(err);
|
|
@@ -191,6 +185,7 @@ class _IOModule extends CoreClass {
|
|
|
Object.keys(ns.connected),
|
|
|
(id, next) => {
|
|
|
const { session } = ns.connected[id];
|
|
|
+
|
|
|
CacheModule.runJob(
|
|
|
"HGET",
|
|
|
{
|
|
@@ -206,7 +201,7 @@ class _IOModule extends CoreClass {
|
|
|
.catch(() => next());
|
|
|
},
|
|
|
() => {
|
|
|
- resolve({ sockets });
|
|
|
+ resolve(sockets);
|
|
|
}
|
|
|
);
|
|
|
}
|