feat(assist): small fix for isLive request
This commit is contained in:
parent
cb4e318650
commit
269b960035
3 changed files with 6 additions and 6 deletions
|
|
@ -41,8 +41,8 @@ const respond = function (req, res, data) {
|
|||
RecordRequestDuration(req.method.toLowerCase(), res.handlerName, 200, duration/1000.0);
|
||||
}
|
||||
|
||||
const getParticularSession = async function (roomId, filters) {
|
||||
let connected_sockets = await fetchSockets(roomId);
|
||||
const getParticularSession = async function (roomId, filters, all=false) {
|
||||
let connected_sockets = await fetchSockets(roomId, all);
|
||||
if (connected_sockets.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ const socketsLiveBySession = async function (req, res) {
|
|||
|
||||
// find a particular session
|
||||
if (_sessionId) {
|
||||
let sessInfo = await getParticularSession(`${_projectKey}-${_sessionId}`, filters);
|
||||
let sessInfo = await getParticularSession(`${_projectKey}-${_sessionId}`, filters, true);
|
||||
return respond(req, res, sessInfo);
|
||||
}
|
||||
return respond(req, res, null);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ function sendTo(to, eventName, ...data) {
|
|||
sendFrom(io, to, eventName, ...data);
|
||||
}
|
||||
|
||||
const fetchSockets = async function (roomID) {
|
||||
const fetchSockets = async function (roomID, all=false) {
|
||||
if (!io) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function sendTo(to, eventName, ...data) {
|
|||
sendFrom(io, to, eventName, ...data);
|
||||
}
|
||||
|
||||
const fetchSockets = async function (roomID) {
|
||||
const fetchSockets = async function (roomID, all=false) {
|
||||
if (!io) {
|
||||
return [];
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ const fetchSockets = async function (roomID) {
|
|||
return await doFetchAllSockets();
|
||||
}
|
||||
try {
|
||||
if (useStickySessions) {
|
||||
if (useStickySessions && !all) {
|
||||
return await io.local.in(roomID).fetchSockets();
|
||||
} else {
|
||||
return await io.in(roomID).fetchSockets();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue