summaryrefslogtreecommitdiff
path: root/src/script_lua.c
diff options
context:
space:
mode:
authorperryitay <85821686+perryitay@users.noreply.github.com>2022-01-20 09:05:53 +0200
committerGitHub <noreply@github.com>2022-01-20 09:05:53 +0200
commitc4b788230ca034761a0e9f6ca35b4aee4b15d340 (patch)
tree50b89484548307841d799786a75e6cc79a5d39d8 /src/script_lua.c
parent22172a4aa648374d7076b179dab18de09f72fd52 (diff)
downloadredis-c4b788230ca034761a0e9f6ca35b4aee4b15d340.tar.gz
Adding module api for processing commands during busy jobs and allow flagging the commands that should be handled at this status (#9963)
Some modules might perform a long-running logic in different stages of Redis lifetime, for example: * command execution * RDB loading * thread safe context During this long-running logic Redis is not responsive. This PR offers 1. An API to process events while a busy command is running (`RM_Yield`) 2. A new flag (`ALLOW_BUSY`) to mark the commands that should be handled during busy jobs which can also be used by modules (`allow-busy`) 3. In slow commands and thread safe contexts, this flag will start rejecting commands with -BUSY only after `busy-reply-threshold` 4. During loading (`rdb_load` callback), it'll process events right away (not wait for `busy-reply-threshold`), but either way, the processing is throttled to the server hz rate. 5. Allow modules to Yield to redis background tasks, but not to client commands * rename `script-time-limit` to `busy-reply-threshold` (an alias to the pre-7.0 `lua-time-limit`) Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/script_lua.c')
-rw-r--r--src/script_lua.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script_lua.c b/src/script_lua.c
index 76e9eb7ad..d7332cf86 100644
--- a/src/script_lua.c
+++ b/src/script_lua.c
@@ -1363,7 +1363,7 @@ void luaCallFunction(scriptRunCtx* run_ctx, lua_State *lua, robj** keys, size_t
* each time the Lua hook is invoked. */
luaSaveOnRegistry(lua, REGISTRY_RUN_CTX_NAME, run_ctx);
- if (server.script_time_limit > 0 && !debug_enabled) {
+ if (server.busy_reply_threshold > 0 && !debug_enabled) {
lua_sethook(lua,luaMaskCountHook,LUA_MASKCOUNT,100000);
delhook = 1;
} else if (debug_enabled) {