Shane 7 months ago
parent 1010a8cb2a
commit b8ab6dded7
  1. 6
      foodie_utils.py

@ -1764,6 +1764,9 @@ def check_author_rate_limit(author, max_tweets=17, tweet_window_seconds=86400):
reset_time = author_info.get('tweet_reset', current_time + tweet_window_seconds)
prune_system_activity(reset_time)
# Debug: log is_any_script_running()
logger.debug(f"[DEBUG] is_any_script_running() = {is_any_script_running()}")
# Check if any script is running
if is_any_script_running():
# At least one script is running, trust rate_limit_info.json
@ -1786,8 +1789,9 @@ def check_author_rate_limit(author, max_tweets=17, tweet_window_seconds=86400):
remaining = remaining - author_info.get('tweets_posted_in_run', 0)
else:
# No scripts are running, post test tweet to sync quota
logger.info(f"No scripts are running, posting test tweet for {username} to sync quota")
logger.debug(f"[DEBUG] NO scripts running, will call get_x_rate_limit_status for {username}")
remaining, api_reset = get_x_rate_limit_status(author)
logger.debug(f"[DEBUG] API returned: remaining={remaining}, api_reset={api_reset} for {username}")
if remaining is None or api_reset is None:
# Fallback: Use last known quota or assume 0 remaining
if current_time < author_info.get('tweet_reset', current_time + tweet_window_seconds):

Loading…
Cancel
Save