From 1d3c74a17e432985bf00e9da92c333922c2a2806 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Sat, 19 Jul 2025 16:35:41 -0500 Subject: [PATCH] reduce mlb logging nouse --- src/mlb_manager.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/mlb_manager.py b/src/mlb_manager.py index c6d28973..27cb614d 100644 --- a/src/mlb_manager.py +++ b/src/mlb_manager.py @@ -973,13 +973,19 @@ class MLBRecentManager(BaseMLBManager): self.last_warning_time = 0 self.warning_cooldown = 300 # Only show warning every 5 minutes logger.info(f"Initialized MLBRecentManager with {len(self.favorite_teams)} favorite teams") + self.last_log_time = 0 + self.log_interval = 300 # 5 minutes def update(self): """Update recent games data.""" current_time = time.time() - self.logger.info(f"Checking for recent MLB games. Last update was at {self.last_update}") + if current_time - self.last_log_time > self.log_interval: + self.logger.info(f"Checking for recent MLB games. Last update was at {self.last_update}") + self.last_log_time = current_time + if self.last_update != 0 and (current_time - self.last_update < self.update_interval): - self.logger.info(f"Skipping recent games update, interval not reached. Next update in {self.update_interval - (current_time - self.last_update):.0f} seconds.") + if current_time - self.last_log_time > self.log_interval: + self.logger.info(f"Skipping recent games update, interval not reached. Next update in {self.update_interval - (current_time - self.last_update):.0f} seconds.") return try: @@ -1086,13 +1092,19 @@ class MLBUpcomingManager(BaseMLBManager): self.last_game_switch = 0 # Track when we last switched games self.game_display_duration = 10 # Display each game for 10 seconds logger.info(f"Initialized MLBUpcomingManager with {len(self.favorite_teams)} favorite teams") + self.last_log_time = 0 + self.log_interval = 300 # 5 minutes def update(self): """Update upcoming games data.""" current_time = time.time() - self.logger.info(f"Checking for upcoming MLB games. Last update was at {self.last_update}") + if current_time - self.last_log_time > self.log_interval: + self.logger.info(f"Checking for upcoming MLB games. Last update was at {self.last_update}") + self.last_log_time = current_time + if self.last_update != 0 and (current_time - self.last_update < self.update_interval): - self.logger.info(f"Skipping upcoming games update, interval not reached. Next update in {self.update_interval - (current_time - self.last_update):.0f} seconds.") + if current_time - self.last_log_time > self.log_interval: + self.logger.info(f"Skipping upcoming games update, interval not reached. Next update in {self.update_interval - (current_time - self.last_update):.0f} seconds.") return try: