@mulingai-npm/redis 3.1.0 → 3.1.1

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.
@@ -58,7 +58,7 @@ class MulingstreamChunkManager {
58
58
  // if (len < 8_000) return 10_000;
59
59
  // if (len < 12_000) return 15_000;
60
60
  // if (len < 20_000) return 20_000;
61
- return 25000;
61
+ return 30000;
62
62
  }
63
63
  /* ---------------------------------------------------------------------- */
64
64
  /* Public API (same) */
@@ -82,13 +82,16 @@ class MulingstreamChunkManager {
82
82
  const pipe = this.redisClient.pipeline();
83
83
  ids.forEach((cid) => pipe.hgetall(this.chunkHashKey(cid)));
84
84
  const res = await pipe.exec();
85
- return res.map(([, d]) => this.hashToChunk(d));
85
+ if (!res)
86
+ return null;
87
+ return res === null || res === void 0 ? void 0 : res.map(([, d]) => this.hashToChunk(d));
86
88
  }
87
89
  getRoomById(roomId) {
88
90
  return this.getMulingstreamChunksByRoom(roomId);
89
91
  }
90
92
  /* ------------------------- chunk insertion ---------------------------- */
91
93
  async addMulingstreamChunk(params) {
94
+ var _a, _b;
92
95
  const { roomId, chunkNumber, language, start, end, duration, isFirst, isLast, theme, sttProviders, targetLanguages, shortCodeTargetLanguages } = params;
93
96
  /* ---------- reset room on first chunk ---------- */
94
97
  if (chunkNumber === 1) {
@@ -145,7 +148,8 @@ class MulingstreamChunkManager {
145
148
  pipe.expire(this.roomZsetKey(roomId), EXPIRATION);
146
149
  pipe.zrange(this.roomZsetKey(roomId), 0, -ROOM_ARRAY_LENGTH - 1, 'WITHSCORES');
147
150
  const execResults = await pipe.exec();
148
- const oldPairs = execResults[4][1]; // [id1, score1, id2, score2, ...]
151
+ /* execResults can be null or shorter than expected — fall back to an empty list */
152
+ const oldPairs = ((_b = (_a = execResults === null || execResults === void 0 ? void 0 : execResults[4]) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : []); // [id1, score1, id2, score2, ...]
149
153
  if (Array.isArray(oldPairs) && oldPairs.length) {
150
154
  const oldIds = [];
151
155
  for (let i = 0; i < oldPairs.length; i += 2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulingai-npm/redis",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {