vani-meeting-server 3.0.3 → 3.0.4-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,7 +39,8 @@ export declare class RedisHandler {
|
|
|
39
39
|
removeParticipantForRoom(roomId: string, participant: Participant): Promise<undefined>;
|
|
40
40
|
addUpdateParticipantForRoom(roomId: string, participant: Participant): Promise<undefined>;
|
|
41
41
|
getParticipantByUserId(roomId: string, userId: string): Promise<Participant | undefined>;
|
|
42
|
-
|
|
42
|
+
private getAllParticipantsFromRedis;
|
|
43
|
+
getAllParticipants(roomId: string): Promise<Participant[]>;
|
|
43
44
|
getAllRoomsId(): Promise<string[] | undefined>;
|
|
44
45
|
private updateRoomCleanupTimeOut;
|
|
45
46
|
releaseRedis: () => Promise<void>;
|
|
@@ -201,8 +201,8 @@ class RedisHandler {
|
|
|
201
201
|
};
|
|
202
202
|
storeKeyValueForLocalCacheFromOtherServer = async (data) => {
|
|
203
203
|
try {
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
// ServerHandler.getInstance().serverStartRequest && ServerHandler.getInstance().serverStartRequest.logLevel !== LogLevel.None
|
|
205
|
+
// && console.log("storeKeyValueForLocalCacheFromOtherServer recived ", data)
|
|
206
206
|
if (data.senderIp !== await Constant_1.default.getPublicIp()) {
|
|
207
207
|
const key = data.data?.key;
|
|
208
208
|
const fieldOne = data.data?.fieldOne;
|
|
@@ -211,8 +211,8 @@ class RedisHandler {
|
|
|
211
211
|
let keyData = this.localCacheDataStorage.get(key);
|
|
212
212
|
if (keyData && fieldOne && fieldTwo) {
|
|
213
213
|
keyData.set(fieldOne, fieldTwo);
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
// ServerHandler.getInstance().serverStartRequest && ServerHandler.getInstance().serverStartRequest.logLevel !== LogLevel.None
|
|
215
|
+
// && console.log("storeKeyValueForLocalCacheFromOtherServer set ", keyData)
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -394,34 +394,50 @@ class RedisHandler {
|
|
|
394
394
|
return undefined;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
async
|
|
397
|
+
async getAllParticipantsFromRedis(roomId) {
|
|
398
|
+
const particpantsInStringify = await this.redisClient.hGetAll(roomId);
|
|
399
|
+
const participants = [];
|
|
400
|
+
if (particpantsInStringify) {
|
|
401
|
+
console.log("getAllParticipantsFromRedis getAllParticipantsFromRedis ", particpantsInStringify);
|
|
402
|
+
Object.entries(particpantsInStringify).forEach(([key, value]) => {
|
|
403
|
+
console.log("getAllParticipantsFromRedis key ", key);
|
|
404
|
+
if (key.includes(RedisKeyType.Participants)) {
|
|
405
|
+
const valueStr = value;
|
|
406
|
+
participants.push(Object.assign(new Participant_1.Participant(), JSON.parse(valueStr)));
|
|
407
|
+
console.log("getAllParticipantsFromRedis key ", valueStr);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return participants;
|
|
412
|
+
}
|
|
413
|
+
async getAllParticipants(roomId) {
|
|
414
|
+
return await this.getAllParticipantsFromRedis(roomId);
|
|
398
415
|
let particpantsInStringify;
|
|
399
416
|
try {
|
|
400
417
|
try {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
console.log("getAllParticipants from cache", particpantsInStringify, canFetchFromLocal);
|
|
406
|
-
}
|
|
418
|
+
const localCacheMessages = this.getKeyValueForLocalCache(roomId);
|
|
419
|
+
if (localCacheMessages) {
|
|
420
|
+
particpantsInStringify = localCacheMessages;
|
|
421
|
+
console.log("getAllParticipants from cache", particpantsInStringify);
|
|
407
422
|
}
|
|
408
423
|
}
|
|
409
424
|
catch (err) {
|
|
410
425
|
}
|
|
411
|
-
if (!particpantsInStringify) {
|
|
412
|
-
particpantsInStringify = await this.redisClient.hGetAll(roomId);
|
|
413
|
-
}
|
|
414
426
|
const participants = [];
|
|
415
427
|
if (particpantsInStringify) {
|
|
416
|
-
|
|
428
|
+
console.log("getAllParticipants particpantsInStringify ", particpantsInStringify);
|
|
429
|
+
const keysArray = [...particpantsInStringify.keys()];
|
|
430
|
+
keysArray.forEach((key) => {
|
|
431
|
+
console.log("getAllParticipants key ", key);
|
|
417
432
|
if (key.includes(RedisKeyType.Participants)) {
|
|
418
|
-
const valueStr =
|
|
433
|
+
const valueStr = particpantsInStringify.get(key);
|
|
419
434
|
participants.push(Object.assign(new Participant_1.Participant(), JSON.parse(valueStr)));
|
|
435
|
+
console.log("getAllParticipants key ", valueStr);
|
|
420
436
|
}
|
|
421
437
|
});
|
|
422
438
|
}
|
|
423
|
-
if (participants.length
|
|
424
|
-
return this.
|
|
439
|
+
if (participants.length < 2) {
|
|
440
|
+
return await this.getAllParticipantsFromRedis(roomId);
|
|
425
441
|
}
|
|
426
442
|
return participants;
|
|
427
443
|
}
|