• guybe7's avatar
    Module unblock on keys: updateStatsOnUnblock is called twice (#13405) · 81440a33
    guybe7 authored
    This commit reverts the deletion of the condition `!bc->blocked_on_keys`
    that was accidentally introduced by
    https://github.com/redis/redis/pull/12817
    
    .
    In case a blocked-on-keys module client is unblocked both
    `moduleUnblockClientOnKey` and `moduleHandleBlockedClients` are called
    which resulted in `updateStatsOnUnblock` being called twice
    
    Now, that `moduleHandleBlockedClients` doesn't call
    `updateStatsOnUnblock` in case of unblocked module key-blocked clients,
    in the unlikely event that the module decides to call `RM_UnblockClient`
    on a key-blocked client, we need to call `updateStatsOnUnblock` from
    within `moduleBlockedClientTimedOut`, but since
    `moduleBlockedClientTimedOut` is not tread-safe we can't call it
    directly from withing `RM_UnblockClient`.
    Added a new flag `blocked_on_keys_explicit_unblock` for that specific
    case, which will cause `moduleBlockedClientTimedOut` to be called from
    `moduleHandleBlockedClients` (which is only called from the main thread)
    
    ---------
    Co-authored-by: default avatardebing.sun <debing.sun@redis.com>
    81440a33
module.c 566 KB