Rewrote CPU Detector to expire correctly
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user