From 49835f351cde1dfeecc5144e0e022db56f5f77e3 Mon Sep 17 00:00:00 2001 From: Shane Date: Thu, 15 May 2025 14:21:10 +1000 Subject: [PATCH] add debug --- check_x_capacity.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check_x_capacity.py b/check_x_capacity.py index bea4257..ee9e4e4 100755 --- a/check_x_capacity.py +++ b/check_x_capacity.py @@ -45,19 +45,23 @@ def should_send_notification(username, reset_time): tracking = load_notification_tracking() author_data = tracking.get(username, {}) reset_time_str = str(reset_time) + logging.debug(f"[DEBUG] should_send_notification: username={username}, reset_time_str={reset_time_str}, author_data={author_data}") if not author_data or str(author_data.get('reset_time')) != reset_time_str: + logging.info(f"[DEBUG] Sending notification for {username}. Previous reset_time: {author_data.get('reset_time')}, New reset_time: {reset_time_str}") tracking[username] = { 'last_notification': datetime.now(timezone.utc).isoformat(), 'reset_time': reset_time_str } save_notification_tracking(tracking) return True + logging.info(f"[DEBUG] Skipping notification for {username}. Already notified for reset_time: {reset_time_str}") return False def send_capacity_alert(username, remaining, reset_time): """Send email alert when an author's tweet capacity is full.""" # Always use string for reset_time reset_time_str = str(reset_time) + logging.debug(f"[DEBUG] send_capacity_alert: username={username}, remaining={remaining}, reset_time_str={reset_time_str}") if not should_send_notification(username, reset_time_str): logger.info(f"Skipping duplicate notification for {username}") return