Don't needlessly call time.monotonic() when checking cache expirations
This commit is contained in:
parent
2f4475a70f
commit
01bad3a76e
1 changed files with 2 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue