From 7cefbeaad5dc299e9b9e26fbb1f517012756a89a Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 23 Oct 2019 18:51:44 +0200 Subject: [PATCH] Modules hooks: select DB zero by default. --- src/module.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/module.c b/src/module.c index 791e82e48..012ef8001 100644 --- a/src/module.c +++ b/src/module.c @@ -5877,6 +5877,11 @@ void moduleFireServerEvent(uint64_t eid, int subid, void *data) { void *moduledata = NULL; RedisModuleClientInfoV1 civ1; + /* 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); if (eid == REDISMODULE_EVENT_CLIENT_CHANGE) { modulePopulateClientInfoStructure(&civ1,data, el->event.dataver);