Skip to content

Commit

Permalink
move script running check to defragLuaScripts
Browse files Browse the repository at this point in the history
Signed-off-by: Ran Shidlansik <[email protected]>
  • Loading branch information
ranshid committed Dec 10, 2024
1 parent d0ac884 commit 30464c2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,6 @@ robj *activeDefragStringOb(robj *ob) {
static luaScript *activeDefragLuaScript(luaScript *script) {
luaScript *ret = NULL;

/* In case we are in the process of eval some script we do not want to replace the script being run
* so we just bail out without really defragging here. */
if (scriptIsRunning()) {
return script;
}

/* try to defrag script struct */
if ((ret = activeDefragAlloc(script))) {
script = ret;
Expand Down Expand Up @@ -1089,6 +1083,9 @@ static doneStatus defragLuaScripts(monotime endtime, void *target, void *privdat
UNUSED(target);
UNUSED(privdata);
if (endtime == 0) return DEFRAG_NOT_DONE; // required initialization
/* In case we are in the process of eval some script we do not want to replace the script being run
* so we just bail out without really defragging here. */
if (scriptIsRunning()) return DEFRAG_DONE;
activeDefragSdsDict(evalScriptsDict(), DEFRAG_SDS_DICT_VAL_LUA_SCRIPT);
return DEFRAG_DONE;
}
Expand Down

0 comments on commit 30464c2

Please sign in to comment.