@mulingai-npm/redis 3.38.13 → 3.39.0

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.
@@ -32,6 +32,10 @@ class DemoRoomPoolManager {
32
32
  const sessionData = await this.redisClient.hgetall(`demo:pool:room:${roomIdStr}:session`);
33
33
  const hasActiveSession = sessionData && sessionData.expiresAt && Date.now() < parseInt(sessionData.expiresAt);
34
34
  if (!hasActiveSession) {
35
+ // Check if room still has an active speaker before reclaiming
36
+ const activeSpeakers = await this.redisClient.scard(`room:${roomIdStr}:speakers`);
37
+ if (activeSpeakers > 0)
38
+ continue; // Room still occupied
35
39
  // Clean up any stale session
36
40
  if (sessionData && sessionData.expiresAt) {
37
41
  await this.redisClient.del(`demo:pool:room:${roomIdStr}:session`);
@@ -55,7 +59,13 @@ class DemoRoomPoolManager {
55
59
  continue; // Already available
56
60
  const expiresAtStr = await this.redisClient.hget(`demo:pool:room:${rid}:session`, 'expiresAt');
57
61
  if (!expiresAtStr || Date.now() >= parseInt(expiresAtStr)) {
58
- // Session expired or key missing — reclaim
62
+ // Session expired or key missing — but check if room still has an active speaker.
63
+ // Without this check, a room could be reclaimed and reassigned while a speaker
64
+ // is still connected, causing mixed transcriptions and timer conflicts.
65
+ const activeSpeakers = await this.redisClient.scard(`room:${rid}:speakers`);
66
+ if (activeSpeakers > 0) {
67
+ continue; // Room still occupied — don't reclaim
68
+ }
59
69
  await this.redisClient.del(`demo:pool:room:${rid}:session`);
60
70
  await this.redisClient.del(`demo:pool:room:${rid}:credits`);
61
71
  await this.redisClient.sadd('demo:pool:available', rid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulingai-npm/redis",
3
- "version": "3.38.13",
3
+ "version": "3.39.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {