From: Magnus Hagander Date: Mon, 25 Aug 2025 10:43:59 +0000 (+0200) Subject: Use utcfromtimestamp() when compating bluesky token expiry X-Git-Url: http://git.postgresql.org/gitweb/delmail?a=commitdiff_plain;h=160bef94c557fc76463aa61b6f02c6d838b22b53;p=pgeu-system.git Use utcfromtimestamp() when compating bluesky token expiry This hopefully fixes the strange "token expired" errors we get that seem to auto recover after 30 minutes. --- diff --git a/postgresqleu/util/messaging/bluesky.py b/postgresqleu/util/messaging/bluesky.py index fb9fd194..8e1ff1cc 100644 --- a/postgresqleu/util/messaging/bluesky.py +++ b/postgresqleu/util/messaging/bluesky.py @@ -122,7 +122,7 @@ class Bluesky(object): def bsjwt(self): if 'accessjwt' in self.providerconfig: # If the access token expires within 30 minutes, refresh it! - if datetime.fromtimestamp(self.providerconfig['accesstokenexpires']) < datetime.utcnow() + timedelta(minutes=30): + if datetime.utcfromtimestamp(self.providerconfig['accesstokenexpires']) < datetime.utcnow() + timedelta(minutes=30): r = requests.post( 'https://bsky.social/xrpc/com.atproto.server.refreshSession', headers={'Authorization': 'Bearer {}'.format(self.providerconfig['refreshjwt'])},