From a0c57268d21e85c47dc4950d274bec3c024ef342 Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 1 Mar 2021 11:53:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B8=85=E7=90=86roomcount?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6,=20=E6=9C=89=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E4=B8=BA=E7=A9=BA=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/Service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/service/Service.ts b/src/service/Service.ts index 5288706..870720e 100644 --- a/src/service/Service.ts +++ b/src/service/Service.ts @@ -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) + } } } - } }