feat(v2): Add pkt_payload to DMs, update watchdog for single container

- Add pkt_payload column to direct_messages table for stable packet
  hash generation and Analyzer URL linking
- Update insert_direct_message() and DeviceManager to store pkt_payload
- Add test for DM pkt_payload storage (43 tests pass)
- Update watchdog to monitor only mc-webui (meshcore-bridge removed)
- USB reset trigger now fires for mc-webui container failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-01 10:01:43 +01:00
parent df8e2d2218
commit e98acf6afa
5 changed files with 20 additions and 6 deletions

View File

@@ -38,8 +38,8 @@ LOG_FILE = os.environ.get('LOG_FILE', '/var/log/mc-webui-watchdog.log')
HTTP_PORT = int(os.environ.get('HTTP_PORT', '5051'))
AUTO_START = os.environ.get('AUTO_START', 'true').lower() != 'false'
# Containers to monitor
CONTAINERS = ['meshcore-bridge', 'mc-webui']
# Containers to monitor (v2: single container, no meshcore-bridge)
CONTAINERS = ['mc-webui']
# Global state
last_check_time = None
@@ -318,8 +318,8 @@ def handle_unhealthy_container(container_name: str, status: dict):
except Exception as e:
log(f"Failed to save diagnostic info: {e}", 'ERROR')
# Check if we should do a USB reset for meshcore-bridge
if container_name == 'meshcore-bridge':
# v2: mc-webui owns the device connection directly — USB reset if repeated failures
if container_name == 'mc-webui':
recent_restarts = count_recent_restarts(container_name, minutes=8)
if recent_restarts >= 3:
log(f"{container_name} has been restarted {recent_restarts} times in the last 8 minutes. Attempting hardware USB reset.", "WARN")