Don't needlessly call time.monotonic() when checking cache expirations

This commit is contained in:
jesopo 2019-06-22 23:30:15 +01:00
parent 2f4475a70f
commit 01bad3a76e

View file

@ -20,7 +20,8 @@ class Cache(object):
expirations = list(filter(None, expirations))
if not expirations:
return None
expirations = [e-time.monotonic() for e in expirations]
now = time.monotonic()
expirations = [e-now for e in expirations]
return max(min(expirations), 0)
def expire(self):