mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-08-28 05:14:12 +00:00
Refactor database connection handling in web viewer and improve error logging; fix keyword reporting to web viewer
- Simplified database connection management by using context managers to ensure connections are properly closed. - Enhanced error handling during MQTT client disconnection in packet capture service, logging specific exceptions. - Updated message handling in MessageHandler to capture command data for web viewer integration, improving response tracking.
This commit is contained in:
@@ -331,8 +331,12 @@ class PacketCaptureService(BaseServicePlugin):
|
||||
try:
|
||||
mqtt_client_info['client'].disconnect()
|
||||
mqtt_client_info['client'].loop_stop()
|
||||
except:
|
||||
pass
|
||||
except (AttributeError, RuntimeError, OSError) as e:
|
||||
# Silently ignore expected errors during cleanup (client already disconnected, etc.)
|
||||
self.logger.debug(f"Error disconnecting MQTT client during cleanup: {e}")
|
||||
except Exception as e:
|
||||
# Log unexpected errors but don't fail cleanup
|
||||
self.logger.warning(f"Unexpected error disconnecting MQTT client: {e}")
|
||||
|
||||
# Close output file
|
||||
if self.output_handle:
|
||||
|
||||
Reference in New Issue
Block a user