From 01bad3a76e97e5e7aec948bff382d23b39d32669 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 22 Jun 2019 23:30:15 +0100 Subject: [PATCH] Don't needlessly call time.monotonic() when checking cache expirations --- src/Cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Cache.py b/src/Cache.py index 73e1fd4d..478aa027 100644 --- a/src/Cache.py +++ b/src/Cache.py @@ -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):