try
This commit is contained in:
+5
-1
@@ -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)
|
reset_time = author_info.get('tweet_reset', current_time + tweet_window_seconds)
|
||||||
prune_system_activity(reset_time)
|
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
|
# Check if any script is running
|
||||||
if is_any_script_running():
|
if is_any_script_running():
|
||||||
# At least one script is running, trust rate_limit_info.json
|
# 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)
|
remaining = remaining - author_info.get('tweets_posted_in_run', 0)
|
||||||
else:
|
else:
|
||||||
# No scripts are running, post test tweet to sync quota
|
# 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)
|
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:
|
if remaining is None or api_reset is None:
|
||||||
# Fallback: Use last known quota or assume 0 remaining
|
# Fallback: Use last known quota or assume 0 remaining
|
||||||
if current_time < author_info.get('tweet_reset', current_time + tweet_window_seconds):
|
if current_time < author_info.get('tweet_reset', current_time + tweet_window_seconds):
|
||||||
|
|||||||
Reference in New Issue
Block a user