From c40d51da8cf3a3ea74c5c1d00e988a9ef0718eac Mon Sep 17 00:00:00 2001 From: Harry Reeder Date: Thu, 9 Apr 2020 11:56:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Ensure=20all=20datetimes=20are?= =?UTF-8?q?=20truly=20UTC=20for=20caching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assh/caching.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assh/caching.py b/assh/caching.py index 94c6672..833b72c 100644 --- a/assh/caching.py +++ b/assh/caching.py @@ -19,10 +19,10 @@ def get_instances(cache_dir): with open(cache_path) as cache_file: cached_response = json.load(cache_file) - cache_updated = datetime.datetime.utcfromtimestamp( - cached_response.get("fetched_at", 0) + cache_updated = datetime.datetime.fromtimestamp( + cached_response.get("fetched_at", 0), tz=datetime.timezone.utc ) - now = datetime.datetime.utcnow() + now = datetime.datetime.now(datetime.timezone.utc) if cache_updated < (now - datetime.timedelta(minutes=1)): instances = _get_fresh_instances()