summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-10-23 10:41:55 +0200
committerantirez <antirez@gmail.com>2019-10-23 10:41:55 +0200
commit3499e88de6ab1b95c4d3fbf1a3cbed288ad54711 (patch)
tree98f318849eaa4d481479b457a31950c31e2b4827
parentaead6eac8d79f85575c4240adce70258a072b35b (diff)
downloadredis-3499e88de6ab1b95c4d3fbf1a3cbed288ad54711.tar.gz
Modules hooks: select the right DB for FLUSHDB events.
-rw-r--r--src/module.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/module.c b/src/module.c
index 21e98185a..0f57c9b14 100644
--- a/src/module.c
+++ b/src/module.c
@@ -5872,6 +5872,9 @@ void moduleFireServerEvent(uint64_t eid, int subid, void *data) {
moduledata = &civ1;
} else if (eid == REDISMODULE_EVENT_FLUSHDB) {
moduledata = data;
+ RedisModuleFlushInfoV1 *fi = data;
+ if (fi->dbnum != -1)
+ selectDb(ctx.client, fi->dbnum);
}
el->callback(&ctx,el->event,subid,moduledata);
moduleFreeContext(&ctx);