From 61270d3af414258100b1542e613a790343a3b278 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Tue, 21 Feb 2023 06:13:02 +0000 Subject: [PATCH] Fix expired check in some cases in Cacher class It seems if a service sets the expiration time in seconds or by a timestamp, then this resolves as expired up to 14 hrs too early, or 14 hours too late, depending on what your timezone is relative to UTC+00:00. However, I haven't fully confirmed if this is the right fix to make. As in, I'm not sure if changing datetime.utcnow() to datetime.now() should be done, or the other way around. However, I've had multiple people tell me changing it this way worked for them so I'm just going to roll with it. --- devine/core/cacher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devine/core/cacher.py b/devine/core/cacher.py index 724d542..71440ac 100644 --- a/devine/core/cacher.py +++ b/devine/core/cacher.py @@ -46,7 +46,7 @@ class Cacher: @property def expired(self) -> bool: - return self.expiration and self.expiration < datetime.utcnow() + return self.expiration and self.expiration < datetime.now() def get(self, key: str, version: int = 1) -> Cacher: """