fix: [api] fix ttl missing bug

This commit is contained in:
Alexandre Dulaunoy 2021-08-22 16:48:06 +02:00
parent ab1b74e109
commit 27aa7c4034
Signed by: adulau
GPG key ID: 09E2CD4944E6CBCD

View file

@ -104,6 +104,9 @@ class lookup(Resource):
if not is_hex(sha1): if not is_hex(sha1):
return {'message': 'SHA-1 is not in hex format'}, 400 return {'message': 'SHA-1 is not in hex format'}, 400
k = sha1.upper() k = sha1.upper()
ttl = False
if session:
ttl = get_session()
if not rdb.exists("h:{}".format(k)): if not rdb.exists("h:{}".format(k)):
if stats: if stats:
rdb.zincrby("s:nx:sha1", score, k) rdb.zincrby("s:nx:sha1", score, k)