Bump to v1.4.0: tap-to-dismiss, docker restart detection, cleanup thread fix
Add /clear-all endpoint and wire it to the tap handler so tapping the display dismisses active warnings/critical alerts. Fix docker detector to track restart count deltas instead of relying on the transient "restarting" state. Wrap cleanup thread in try/except so it can't die silently and leave events stuck forever. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,7 @@ def main():
|
||||
print()
|
||||
|
||||
active_alerts = set()
|
||||
last_restart_counts = {}
|
||||
|
||||
while True:
|
||||
containers = get_container_status()
|
||||
@@ -137,15 +138,23 @@ def main():
|
||||
|
||||
event_id = f"docker_{name.replace('/', '_')}"
|
||||
|
||||
# Check for restarting state
|
||||
if state == "restarting":
|
||||
# Check restart count for running/restarting containers
|
||||
# The "restarting" state is too transient to catch reliably,
|
||||
# so we track count increases between checks instead
|
||||
if state in ("running", "restarting"):
|
||||
restart_count = get_restart_count(name)
|
||||
if restart_count >= RESTART_THRESHOLD:
|
||||
prev_count = last_restart_counts.get(name, restart_count)
|
||||
new_restarts = restart_count - prev_count
|
||||
last_restart_counts[name] = restart_count
|
||||
|
||||
if state == "restarting" or new_restarts >= RESTART_THRESHOLD:
|
||||
send_event(event_id, 1, f"Container '{name}' restart loop ({restart_count}x)")
|
||||
current_alerts.add(event_id)
|
||||
else:
|
||||
elif new_restarts > 0:
|
||||
send_event(event_id, 2, f"Container '{name}' restarting ({restart_count}x)")
|
||||
current_alerts.add(event_id)
|
||||
else:
|
||||
print(f"[OK] Container '{name}' is {state}")
|
||||
|
||||
# Check for exited/dead containers (warning)
|
||||
elif state in ("exited", "dead"):
|
||||
|
||||
Reference in New Issue
Block a user