From 9497f6e671dff3c742ce9a4ec7d8226bff102121 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Sun, 14 Aug 2022 15:43:13 +0200 Subject: [PATCH] fix(aurweb): resolve exception in ratelimit Redis's get() method can return None which makes an RPC request error out: File "/srv/http/aurweb/aurweb/ratelimit.py", line 103, in check_ratelimit requests = int(requests.decode()) AttributeError: 'NoneType' object has no attribute 'decode' --- aurweb/ratelimit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aurweb/ratelimit.py b/aurweb/ratelimit.py index 659ab6b8..86063f5d 100644 --- a/aurweb/ratelimit.py +++ b/aurweb/ratelimit.py @@ -94,7 +94,7 @@ def check_ratelimit(request: Request): # valid cache value will be returned which must be converted # to an int. Otherwise, use the database record returned # by update_ratelimit. - if not config.getboolean("ratelimit", "cache"): + if not config.getboolean("ratelimit", "cache") or requests is None: # If we got nothing from pipeline.get, we did not use # the Redis path of logic: use the DB record's count. requests = record.Requests