修正清理roomcount信息时, 有时报对象为空的bug

This commit is contained in:
zhl 2021-03-01 11:53:49 +08:00
parent 925976cbae
commit a0c57268d2

View File

@ -141,11 +141,12 @@ export class Service {
const nodes = nodeStrs.map(data => parseNode(data))
const nodeMap = nodes.toMap('processId')
const countObjs = await client.hgetall(ROOM_COUNT_KEY)
for (let key of Object.keys(countObjs)) {
if (!nodeMap.has(key)) {
await client.hdel(ROOM_COUNT_KEY, key)
if (countObjs) {
for (let key of Object.keys(countObjs)) {
if (!nodeMap.has(key)) {
await client.hdel(ROOM_COUNT_KEY, key)
}
}
}
}
}