Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nanos committed Jul 2, 2024
1 parent 5f290b5 commit 0e2178c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions find_posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,14 +1530,14 @@ def fetch_timeline_context(timeline_posts, token, parsed_urls, seen_hosts, seen_
recently_checked_context = json.load(f)

# Remove any toots that we haven't seen in a while, to ensure this doesn't grow indefinitely
for tootUrl in recently_checked_context:
for tootUrl in list(recently_checked_context):
recently_checked_context[tootUrl]['lastSeen'] = parser.parse(recently_checked_context[tootUrl]['lastSeen'])
recently_checked_context[tootUrl]['created_at'] = parser.parse(recently_checked_context[tootUrl]['created_at'])
lastSeen = recently_checked_context[tootUrl]['lastSeen']
userAge = datetime.now(lastSeen.tzinfo) - lastSeen
# dont really need to keep track for more than 7 days: if we haven't seen it in 7 days we can refetch content anyway
if(userAge.total_seconds() > 7 * 24 * 60 * 60):
recently_checked_users.pop(tootUrl)
recently_checked_context.pop(tootUrl)

parsed_urls = {}

Expand Down

0 comments on commit 0e2178c

Please sign in to comment.