From 231e80cbc2e178c670e6d187649cf5704df30845 Mon Sep 17 00:00:00 2001 From: "wei.kukey" Date: Thu, 13 Jun 2024 14:06:59 +0800 Subject: [PATCH] fix reply schema and add fast path to return noscript err Change-Id: Ia756dc5db4ebad5c83b4cc3b7f4a6702f94cfca4 Signed-off-by: wei.kukey --- src/commands/script-dump.json | 4 ++-- src/eval.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/script-dump.json b/src/commands/script-dump.json index a43cb0086d..a1ba0204e7 100644 --- a/src/commands/script-dump.json +++ b/src/commands/script-dump.json @@ -26,8 +26,8 @@ "type": "string" }, { - "description": "null if sha1 hash does not exist in script cache.", - "type": "null" + "description": "noscript error if sha1 hash does not exist in script cache.", + "const": "NOSCRIPT No matching script." } ] } diff --git a/src/eval.c b/src/eval.c index d992af6a71..1863569e09 100644 --- a/src/eval.c +++ b/src/eval.c @@ -734,7 +734,7 @@ NULL dictEntry *de; luaScript *ls; - if ((de = dictFind(lctx.lua_scripts, c->argv[2]->ptr))) { + if (sdslen(c->argv[2]->ptr) == 40 && (de = dictFind(lctx.lua_scripts, c->argv[2]->ptr))) { ls = dictGetVal(de); addReplyBulk(c, ls->body); } else {