fix: handle None from Redis in get_message_counter

The int response callback on hget raises TypeError when the key is
missing, so the None check in the mixin never actually executed.
Bypass the callback and handle the conversion manually.
This commit is contained in:
jwinterm
2026-03-21 09:22:53 -04:00
parent 701370d3fd
commit f23379a251
+5 -2
View File
@@ -7,5 +7,8 @@ from . import constants
def get_message_counter(key):
"""Return current counter for given key."""
rclient = get_redis_connection()
return rclient.hget(constants.REDIS_HASHNAME, key)
rclient = get_redis_connection(hget_return_type=None)
value = rclient.hget(constants.REDIS_HASHNAME, key)
if value is None:
return None
return int(value)