Skip to content

Commit

Permalink
On my account, I get the message "Received duplicate event..." within…
Browse files Browse the repository at this point in the history
… an endless loop, so is it possible to set the variable added_last_event only, if there are no duplicates? (#107)
  • Loading branch information
blanke authored Aug 6, 2024
1 parent 86f425d commit 2f62b09
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytr/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,16 @@ async def get_next_timeline_activity_log(self, response=None):
await self.tr.timeline_activity_log()
else:
self.num_timelines += 1
added_last_event = True
added_last_event = False
for event in response['items']:
if self.max_age_timestamp == 0 or datetime.fromisoformat(event['timestamp'][:19]).timestamp() >= self.max_age_timestamp:
if event['id'] in self.timeline_events:
self.log.warning(f"Received duplicate event {event['id'] }")
else:
added_last_event = True
event['source'] = "timelineActivity"
self.timeline_events[event['id']] = event
else:
added_last_event = False
break

self.log.info(f'Received #{self.num_timelines:<2} timeline activity log')
Expand Down

0 comments on commit 2f62b09

Please sign in to comment.