Fix: event TTL and version display - add default TTL for priority 1/2 events, fetch fresh state after version tap
This commit is contained in:
@@ -19,6 +19,7 @@ ROOT_DIR = Path(__file__).parent
|
||||
# Configuration
|
||||
STATUS_FILE = Path(__file__).parent / "status.json"
|
||||
DEFAULT_NOTIFY_TTL = 10 # Default TTL for Priority 3 (Notify) events
|
||||
DEFAULT_EVENT_TTL = 60 # Default TTL for Priority 1/2 events without explicit TTL
|
||||
CELEBRATION_DURATION = 5 # Seconds to show celebration after recovery
|
||||
IDLE_EXPRESSION_CHANCE = 0.15 # Chance of a brief blink/wink on wake
|
||||
DEFAULT_NOTIFY_DURATION = 5 # Default duration for /notify events
|
||||
@@ -230,11 +231,13 @@ def post_event():
|
||||
"timestamp": time.time(),
|
||||
}
|
||||
|
||||
# Apply TTL if provided, or use default for Priority 3 (Notify)
|
||||
# Apply TTL if provided, or use default based on priority
|
||||
if "ttl" in data:
|
||||
event["ttl"] = time.time() + int(data["ttl"])
|
||||
elif priority == 3:
|
||||
event["ttl"] = time.time() + DEFAULT_NOTIFY_TTL
|
||||
else:
|
||||
event["ttl"] = time.time() + DEFAULT_EVENT_TTL
|
||||
|
||||
with events_lock:
|
||||
active_events[event_id] = event
|
||||
|
||||
Reference in New Issue
Block a user