summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/module.c7
-rw-r--r--tests/unit/moduleapi/hooks.tcl13
2 files changed, 13 insertions, 7 deletions
diff --git a/src/module.c b/src/module.c
index 454042668..c42536449 100644
--- a/src/module.c
+++ b/src/module.c
@@ -8094,7 +8094,6 @@ void moduleCallClusterReceivers(const char *sender_id, uint64_t module_id, uint8
if (r->module_id == module_id) {
RedisModuleCtx ctx;
moduleCreateContext(&ctx, r->module, REDISMODULE_CTX_TEMP_CLIENT);
- selectDb(ctx.client, 0);
r->callback(&ctx,sender_id,type,payload,len);
moduleFreeContext(&ctx);
return;
@@ -10907,11 +10906,6 @@ void moduleFireServerEvent(uint64_t eid, int subid, void *data) {
RedisModuleClientInfoV1 civ1;
RedisModuleReplicationInfoV1 riv1;
RedisModuleModuleChangeV1 mcv1;
- /* Start at DB zero by default when calling the handler. It's
- * up to the specific event setup to change it when it makes
- * sense. For instance for FLUSHDB events we select the correct
- * DB automatically. */
- selectDb(ctx.client, 0);
/* Event specific context and data pointer setup. */
if (eid == REDISMODULE_EVENT_CLIENT_CHANGE) {
@@ -11396,7 +11390,6 @@ int moduleLoad(const char *path, void **module_argv, int module_argc, int is_loa
}
RedisModuleCtx ctx;
moduleCreateContext(&ctx, NULL, REDISMODULE_CTX_TEMP_CLIENT); /* We pass NULL since we don't have a module yet. */
- selectDb(ctx.client, 0);
if (onload((void*)&ctx,module_argv,module_argc) == REDISMODULE_ERR) {
serverLog(LL_WARNING,
"Module %s initialization failed. Module not loaded",path);
diff --git a/tests/unit/moduleapi/hooks.tcl b/tests/unit/moduleapi/hooks.tcl
index 814f31bc0..6e79f942e 100644
--- a/tests/unit/moduleapi/hooks.tcl
+++ b/tests/unit/moduleapi/hooks.tcl
@@ -15,6 +15,19 @@ tags "modules" {
assert {[r hooks.event_count client-disconnected] > 1}
}
+ test {Test module client change event for blocked client} {
+ set rd [redis_deferring_client]
+ # select db other than 0
+ $rd select 1
+ # block on key
+ $rd brpop foo 0
+ # kill blocked client
+ r client kill skipme yes
+ # assert server is still up
+ assert_equal [r ping] PONG
+ $rd close
+ }
+
test {Test module cron hook} {
after 100
assert {[r hooks.event_count cron-loop] > 0}