mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
Feature/memory optimization config (#108)
* feat(config): optimize memory usage to prevent OOM killer - Reduce brightness from 95 to 50 to lower power consumption - Reduce refresh rate from 120Hz to 100Hz to reduce CPU/memory pressure - Reduce background service workers from 3 to 1 per manager - Change hardware mapping from adafruit-hat-pwm to adafruit-hat - Expected memory savings: ~700MB reduction in background service usage - Addresses SIGKILL errors caused by memory exhaustion on Raspberry Pi Fixes: OOM killer terminating ledmatrix.service with status=9/KILL * revert display brightness * refactor(background-service): hardcode optimized settings and remove config blocks - Hardcode background service to 1 worker in all managers - Remove background_service config blocks from template - Simplify configuration for users - no need to adjust system settings - Memory optimization: ~700MB reduction in background service usage - Settings: 1 worker, 30s timeout, 3 retries (hardcoded) Files updated: - src/base_classes/sports.py - src/leaderboard_manager.py - src/odds_ticker_manager.py - src/soccer_managers.py - src/milb_manager.py - config/config.template.json This prevents OOM killer errors by reducing memory usage from 15 background threads to 5 threads total across all managers. * remove fallback in case of background service failure
This commit is contained in:
@@ -105,19 +105,12 @@ class SportsCore(ABC):
|
||||
self._rankings_cache_timestamp = 0
|
||||
self._rankings_cache_duration = 3600 # Cache rankings for 1 hour
|
||||
|
||||
# Initialize background data service
|
||||
background_config = self.mode_config.get("background_service", {})
|
||||
if background_config.get("enabled", True): # Default to enabled
|
||||
max_workers = background_config.get("max_workers", 3)
|
||||
self.background_service = get_background_service(self.cache_manager, max_workers)
|
||||
self.background_fetch_requests = {} # Track background fetch requests
|
||||
self.background_enabled = True
|
||||
self.logger.info(f"Background service enabled with {max_workers} workers")
|
||||
else:
|
||||
self.background_service = None
|
||||
self.background_fetch_requests = {}
|
||||
self.background_enabled = False
|
||||
self.logger.info("Background service disabled")
|
||||
# Initialize background data service with optimized settings
|
||||
# Hardcoded for memory optimization: 1 worker, 30s timeout, 3 retries
|
||||
self.background_service = get_background_service(self.cache_manager, max_workers=1)
|
||||
self.background_fetch_requests = {} # Track background fetch requests
|
||||
self.background_enabled = True
|
||||
self.logger.info("Background service enabled with 1 worker (memory optimized)")
|
||||
|
||||
def _get_season_schedule_dates(self) -> tuple[str, str]:
|
||||
return "", ""
|
||||
|
||||
Reference in New Issue
Block a user