Updated Celebrations and Silent Dying on Critical/Warning
This commit is contained in:
@@ -118,7 +118,7 @@ def get_current_state():
|
||||
sound = top_event["sound"]
|
||||
|
||||
# Check for recovery (was bad, now optimal)
|
||||
if priority == 4 and previous_priority < 4:
|
||||
if priority == 4 and previous_priority < 3:
|
||||
celebrating_until = now + CELEBRATION_DURATION
|
||||
|
||||
previous_priority = priority
|
||||
@@ -171,20 +171,23 @@ def write_status():
|
||||
def cleanup_expired_events():
|
||||
"""Background thread to remove expired TTL events."""
|
||||
while True:
|
||||
time.sleep(1)
|
||||
now = time.time()
|
||||
expired = []
|
||||
try:
|
||||
time.sleep(1)
|
||||
now = time.time()
|
||||
expired = []
|
||||
|
||||
with events_lock:
|
||||
for eid, event in active_events.items():
|
||||
if event.get("ttl") and now > event["ttl"]:
|
||||
expired.append(eid)
|
||||
with events_lock:
|
||||
for eid, event in active_events.items():
|
||||
if event.get("ttl") and now > event["ttl"]:
|
||||
expired.append(eid)
|
||||
|
||||
for eid in expired:
|
||||
del active_events[eid]
|
||||
for eid in expired:
|
||||
del active_events[eid]
|
||||
|
||||
if expired:
|
||||
write_status()
|
||||
if expired:
|
||||
write_status()
|
||||
except Exception as e:
|
||||
print(f"[cleanup] Error: {e}")
|
||||
|
||||
|
||||
@app.route("/event", methods=["POST"])
|
||||
|
||||
Reference in New Issue
Block a user