From fe37e4fc874a92dcf61b3b0de899ec6f674d2442 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Thu, 5 Oct 2023 12:50:17 +0200 Subject: [PATCH] Cleanup nested module keyspace notifications (#12630) Recently we added a way for the module to declare that it wishes to receive nested KSN, by setting ALLOW_NESTED_KEYSPACE_NOTIFICATIONS. but it looks like this flow has a bug, clearing the `active` member when it was previously set. however, since nesting is permitted, this bug has no implications, since regardless of the active member, the notification is permitted. --- src/module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/module.c b/src/module.c index 4bd901c02..093973261 100644 --- a/src/module.c +++ b/src/module.c @@ -8763,11 +8763,12 @@ void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid) /* mark the handler as active to avoid reentrant loops. * If the subscriber performs an action triggering itself, * it will not be notified about it. */ + int prev_active = sub->active; sub->active = 1; server.lazy_expire_disabled++; sub->notify_callback(&ctx, type, event, key); server.lazy_expire_disabled--; - sub->active = 0; + sub->active = prev_active; moduleFreeContext(&ctx); } }