@mulingai-npm/redis 1.7.0 → 1.7.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.
|
@@ -57,4 +57,5 @@ export declare class MulingstreamChunkManager {
|
|
|
57
57
|
getMulingstreamChunk(mulingstreamChunkId: string): Promise<MulingstreamChunkData | null>;
|
|
58
58
|
getMulingstreamChunksByRoom(roomId: string): Promise<MulingstreamChunkData[]>;
|
|
59
59
|
getByChunkNumber(chunkNumber: number, roomId: string): Promise<MulingstreamChunkData | null>;
|
|
60
|
+
updateSttStatus(mulingstreamChunkId: string, status: SttStatus): Promise<boolean>;
|
|
60
61
|
}
|
|
@@ -129,5 +129,21 @@ class MulingstreamChunkManager {
|
|
|
129
129
|
}
|
|
130
130
|
return this.parseHashData(data);
|
|
131
131
|
}
|
|
132
|
+
async updateSttStatus(mulingstreamChunkId, status) {
|
|
133
|
+
// Fetch the chunk data first
|
|
134
|
+
const data = await this.redisClient.hgetall(`mulingstreamChunk:${mulingstreamChunkId}`);
|
|
135
|
+
if (!data || !data.mulingstreamChunkId) {
|
|
136
|
+
return false; // The chunk may not exist or has expired
|
|
137
|
+
}
|
|
138
|
+
// Parse the existing stt field
|
|
139
|
+
const stt = JSON.parse(data.stt);
|
|
140
|
+
// Update the status
|
|
141
|
+
stt.status = status;
|
|
142
|
+
// Write back the updated stt object
|
|
143
|
+
await this.redisClient.hset(`mulingstreamChunk:${mulingstreamChunkId}`, {
|
|
144
|
+
stt: JSON.stringify(stt)
|
|
145
|
+
});
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
132
148
|
}
|
|
133
149
|
exports.MulingstreamChunkManager = MulingstreamChunkManager;
|