forked from DRMTalks/devine
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.
This commit is contained in:
parent
42aaa03941
commit
61270d3af4
|
@ -46,7 +46,7 @@ class Cacher:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def expired(self) -> bool:
|
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:
|
def get(self, key: str, version: int = 1) -> Cacher:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue