Verified Commit 9497f6e6 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

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'
parent 4565aa38
Pipeline #24659 passed with stages
in 2 minutes and 43 seconds
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment