From ac2b648e05a21e6e1d16934928e83911eacc7da1 Mon Sep 17 00:00:00 2001 From: nanos Date: Tue, 25 Jun 2024 10:54:00 +0100 Subject: [PATCH] change timeout periods to never allow more than once per minute --- find_posts.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/find_posts.py b/find_posts.py index 639970b..29332af 100644 --- a/find_posts.py +++ b/find_posts.py @@ -478,13 +478,13 @@ def toot_context_should_be_fetched(toot): lastSeenInSeconds = (datetime.now(lastSeen.tzinfo) - lastSeen).total_seconds() ageInSeconds = (datetime.now(createdAt.tzinfo) - createdAt).total_seconds() - if(ageInSeconds <= 60 * 60): - # For the first hour: allow refetching context as desired + if(ageInSeconds <= 60 * 60 and lastSeenInSeconds >= 60): + # For the first hour: allow refetching once per minute return True - if(ageInSeconds <= 24 * 60 * 60 and lastSeenInSeconds > 10 * 60): - # For the next day: once every 10 minutes + if(ageInSeconds <= 24 * 60 * 60 and lastSeenInSeconds >= 10 * 60): + # For the rest of the first day: once every 10 minutes return True - if(lastSeenInSeconds > 60 * 60): + if(lastSeenInSeconds >= 60 * 60): # After that: hourly return True return False