mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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'
This commit is contained in:
parent
4565aa38cf
commit
9497f6e671
1 changed files with 1 additions and 1 deletions
|
@ -94,7 +94,7 @@ def check_ratelimit(request: Request):
|
||||||
# valid cache value will be returned which must be converted
|
# valid cache value will be returned which must be converted
|
||||||
# to an int. Otherwise, use the database record returned
|
# to an int. Otherwise, use the database record returned
|
||||||
# by update_ratelimit.
|
# 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
|
# If we got nothing from pipeline.get, we did not use
|
||||||
# the Redis path of logic: use the DB record's count.
|
# the Redis path of logic: use the DB record's count.
|
||||||
requests = record.Requests
|
requests = record.Requests
|
||||||
|
|
Loading…
Add table
Reference in a new issue