mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-05-05 04:52:16 +02:00
🔧 Memory Management Enhancements: - Add memory cleanup constants (MAX_CMD_HISTORY=1000, MAX_SEEN_NODES=500, MAX_MSG_HISTORY=100) - Implement cleanup_memory() function to prevent unbounded list growth - Add periodic cleanup every hour via watchdog process - Clean up stale game tracker entries automatically - Limit cmdHistory and msg_history sizes to prevent memory bloat 🚀 Async Task Management Improvements: - Fix async task management in both mesh_bot.py and pong_bot.py - Implement proper task cleanup and cancellation on shutdown - Add task names for better debugging and monitoring - Use asyncio.gather() with return_exceptions=True for better error handling - Prevent task hanging and resource leaks 🛡️ Enhanced Resource Management: - Improve exit_handler() with proper interface cleanup - Add atexit.register() for automatic graceful shutdown - Ensure all meshtastic interfaces are properly closed - Save persistent data (BBS, email, SMS, game scores) on exit - Perform final memory cleanup during shutdown 🔍 Better Exception Handling: - Replace bare except: blocks with specific exception handling - Add proper error logging throughout the codebase - Improve BBS database operations with better error recovery - Add try/catch blocks for file operations and imports 📈 System Stability Improvements: - Prevent memory leaks from growing lists and dictionaries - Add automatic cleanup of stale player tracking data - Improve error recovery in watchdog and async loops - Better handling of interface connection failures These changes address critical memory management issues that could cause the bot to consume increasing memory over time, eventually leading to system instability. The improvements ensure long-term reliability and better resource utilization. Fixes: Memory leaks, async task hanging, resource cleanup issues Improves: System stability, error handling, resource management Tested: Code analysis and review completed
9.3 KiB
9.3 KiB