From 02adca4bc1cc50a232703d2b48ea41a18fa82c93 Mon Sep 17 00:00:00 2001 From: Sam Wen Date: Tue, 11 Jan 2022 09:06:25 -0500 Subject: [PATCH] fix: fix exceptions on messages of client side cache (#1479) when works with the new server assist client side cache feature, redis sends single string "__redis__:invalidate" from server. so reply[2] is null, the update fixes the issue --- lib/DataHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DataHandler.ts b/lib/DataHandler.ts index eb062ae3..bce39173 100644 --- a/lib/DataHandler.ts +++ b/lib/DataHandler.ts @@ -119,7 +119,7 @@ export default class DataHandler { case "message": if (this.redis.listeners("message").length > 0) { // Check if there're listeners to avoid unnecessary `toString()`. - this.redis.emit("message", reply[1].toString(), reply[2].toString()); + this.redis.emit("message", reply[1].toString(), reply[2] ? reply[2].toString() : ''); } this.redis.emit("messageBuffer", reply[1], reply[2]); break;