From 7b5f4b175b96dca2093dc1898c3df97e3e096526 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 3 Dec 2019 16:21:23 +0100 Subject: [PATCH] Modules: create timers in contexts without a client. --- src/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module.c b/src/module.c index be64af368..65c0f5b3f 100644 --- a/src/module.c +++ b/src/module.c @@ -5150,7 +5150,7 @@ RedisModuleTimerID RM_CreateTimer(RedisModuleCtx *ctx, mstime_t period, RedisMod timer->module = ctx->module; timer->callback = callback; timer->data = data; - timer->dbid = ctx->client->db->id; + timer->dbid = ctx->client ? ctx->client->db->id : 0; uint64_t expiretime = ustime()+period*1000; uint64_t key;