Make the check for if script is running or not consistent (#10725)
sometimes it is using `scriptIsRunning()` and other times it is using `server.in_script`. We should use the `scriptIsRunning()` method consistently throughout the code base. Removed server.in_script sine it's no longer used / needed.
This commit is contained in:
parent
4b262182d9
commit
a7d6ca9770
@ -56,6 +56,7 @@
|
||||
#include "slowlog.h"
|
||||
#include "rdb.h"
|
||||
#include "monotonic.h"
|
||||
#include "script.h"
|
||||
#include "call_reply.h"
|
||||
#include <dlfcn.h>
|
||||
#include <sys/stat.h>
|
||||
@ -3485,7 +3486,7 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
|
||||
}
|
||||
}
|
||||
|
||||
if (server.in_script)
|
||||
if (scriptIsRunning())
|
||||
flags |= REDISMODULE_CTX_FLAGS_LUA;
|
||||
|
||||
if (server.in_exec)
|
||||
@ -7058,7 +7059,7 @@ void unblockClientFromModule(client *c) {
|
||||
*/
|
||||
RedisModuleBlockedClient *moduleBlockClient(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms, RedisModuleString **keys, int numkeys, void *privdata) {
|
||||
client *c = ctx->client;
|
||||
int islua = server.in_script;
|
||||
int islua = scriptIsRunning();
|
||||
int ismulti = server.in_exec;
|
||||
|
||||
c->bpop.module_blocked_handle = zmalloc(sizeof(RedisModuleBlockedClient));
|
||||
|
@ -202,8 +202,6 @@ int scriptPrepareForRun(scriptRunCtx *run_ctx, client *engine_client, client *ca
|
||||
script_client->flags |= CLIENT_MULTI;
|
||||
}
|
||||
|
||||
server.in_script = 1;
|
||||
|
||||
run_ctx->start_time = getMonotonicUs();
|
||||
run_ctx->snapshot_time = mstime();
|
||||
|
||||
@ -236,7 +234,6 @@ void scriptResetRun(scriptRunCtx *run_ctx) {
|
||||
/* After the script done, remove the MULTI state. */
|
||||
run_ctx->c->flags &= ~CLIENT_MULTI;
|
||||
|
||||
server.in_script = 0;
|
||||
server.script_caller = NULL;
|
||||
|
||||
if (scriptIsTimedout()) {
|
||||
|
@ -2500,7 +2500,6 @@ void initServer(void) {
|
||||
server.pubsub_patterns = dictCreate(&keylistDictType);
|
||||
server.pubsubshard_channels = dictCreate(&keylistDictType);
|
||||
server.cronloops = 0;
|
||||
server.in_script = 0;
|
||||
server.in_exec = 0;
|
||||
server.busy_module_yield_flags = BUSY_MODULE_YIELD_NONE;
|
||||
server.busy_module_yield_reply = NULL;
|
||||
@ -3566,7 +3565,7 @@ int processCommand(client *c) {
|
||||
* That is unless lua_timedout, in which case client may run
|
||||
* some commands. */
|
||||
serverAssert(!server.in_exec);
|
||||
serverAssert(!server.in_script);
|
||||
serverAssert(!scriptIsRunning());
|
||||
}
|
||||
|
||||
moduleCallCommandFilters(c);
|
||||
|
@ -1476,7 +1476,6 @@ struct redisServer {
|
||||
int sentinel_mode; /* True if this instance is a Sentinel. */
|
||||
size_t initial_memory_usage; /* Bytes used after initialization. */
|
||||
int always_show_logo; /* Show logo even for non-stdout logging. */
|
||||
int in_script; /* Are we inside EVAL? */
|
||||
int in_exec; /* Are we inside EXEC? */
|
||||
int busy_module_yield_flags; /* Are we inside a busy module? (triggered by RM_Yield). see BUSY_MODULE_YIELD_ flags. */
|
||||
const char *busy_module_yield_reply; /* When non-null, we are inside RM_Yield. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user