Rewrote CPU Detector to expire correctly

This commit is contained in:
2026-03-09 15:44:03 -05:00
parent 1ecd7607f0
commit 4f4f5da14c
2 changed files with 21 additions and 27 deletions

View File

@@ -7,9 +7,12 @@ import requests
DEFAULT_AGGREGATOR_URL = "http://localhost:5100"
def send_event(url, event_id, priority, message, check_interval):
"""Send an event to the aggregator with heartbeat TTL."""
ttl = check_interval * 2
def send_event(url, event_id, priority, message, check_interval=None, ttl=None):
"""Send an event to the aggregator.
Pass ttl= (seconds) directly, or check_interval= to use heartbeat default (check_interval * 2).
"""
if ttl is None:
ttl = check_interval * 2
try:
response = requests.post(
f"{url}/event",