mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-12 02:45:45 +02:00
fix(lua): Avoid infinite loop and fix sha compatibility with redis.
Fixes #146 and fixes #147. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
f24005407b
commit
c23dc1c94c
4 changed files with 18 additions and 9 deletions
|
@ -53,10 +53,12 @@ void ScriptMgr::Run(CmdArgList args, ConnectionContext* cntx) {
|
|||
|
||||
if (subcmd == "LOAD" && args.size() == 2) {
|
||||
string_view body = ArgS(args, 1);
|
||||
body = absl::StripAsciiWhitespace(body);
|
||||
|
||||
if (body.empty())
|
||||
return (*cntx)->SendError("Refuse to load empty script");
|
||||
if (body.empty()) {
|
||||
char sha[41];
|
||||
Interpreter::FuncSha1(body, sha);
|
||||
return (*cntx)->SendBulkString(sha);
|
||||
}
|
||||
|
||||
Interpreter& interpreter = ServerState::tlocal()->GetInterpreter();
|
||||
// no need to lock the interpreter since we do not mess the stack.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue