From 04cad7fbf2db5e14a478e2eb1dc825346abe41dd Mon Sep 17 00:00:00 2001 From: liukun Date: Tue, 3 Dec 2019 18:51:27 +0800 Subject: [PATCH] fix: prevent exception when send custom command When send command not in `redis-commands`, it may raise exception 'Unknown command' when `status` not 'ready'. --- lib/redis/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/redis/index.ts b/lib/redis/index.ts index 3891ecac..1c7c865f 100644 --- a/lib/redis/index.ts +++ b/lib/redis/index.ts @@ -663,6 +663,7 @@ Redis.prototype.sendCommand = function(command, stream) { this.status === "ready" || (!stream && this.status === "connect" && + commands.exists(command.name) && commands.hasFlag(command.name, "loading")); if (!this.stream) { writable = false;