this repo has no description

feeds: better handling of missing createdAt

+4 -1
feeds/__init__.py
···
return datetime.now(timezone.utc)
def safe_timestamp(self, timestamp):
parsed = self.parse_timestamp(timestamp)
-
utc_now = datetime.now(timezone.utc)
if parsed.timestamp() <= 0:
return utc_now
elif parsed - timedelta(minutes=2) < utc_now:
···
return datetime.now(timezone.utc)
def safe_timestamp(self, timestamp):
+
utc_now = datetime.now(timezone.utc)
+
if timestamp is None:
+
return utc_now
+
parsed = self.parse_timestamp(timestamp)
if parsed.timestamp() <= 0:
return utc_now
elif parsed - timedelta(minutes=2) < utc_now:
+1 -1
feeds/battle.py
···
path = op['path']
post_uri = f'at://{repo}/{path}'
length = grapheme.length(record.get('text', ''))
-
ts = self.safe_timestamp(record.get('createdAt', '')).timestamp()
self.transaction_begin(self.db_cnx)
···
path = op['path']
post_uri = f'at://{repo}/{path}'
length = grapheme.length(record.get('text', ''))
+
ts = self.safe_timestamp(record.get('createdAt')).timestamp()
self.transaction_begin(self.db_cnx)
+1 -1
feeds/popular.py
···
if record is None:
return
-
ts = self.safe_timestamp(record['createdAt']).timestamp()
like_subject_uri = op['record']['subject']['uri']
self.transaction_begin(self.db_cnx)
···
if record is None:
return
+
ts = self.safe_timestamp(record.get('createdAt')).timestamp()
like_subject_uri = op['record']['subject']['uri']
self.transaction_begin(self.db_cnx)
+1 -1
feeds/rapidfire.py
···
repo = commit['repo']
path = op['path']
post_uri = f'at://{repo}/{path}'
-
ts = self.safe_timestamp(record.get('createdAt', '')).timestamp()
self.transaction_begin(self.db_cnx)
···
repo = commit['repo']
path = op['path']
post_uri = f'at://{repo}/{path}'
+
ts = self.safe_timestamp(record.get('createdAt')).timestamp()
self.transaction_begin(self.db_cnx)