Do not timeout if only asked to you
Build, push image, and notify Watchtower / build-image (push) Successful in 40s
Build, push image, and notify Watchtower / notify (push) Successful in 8s

This commit is contained in:
2026-08-17 23:03:34 +02:00
parent ab8199344c
commit bcc3670aff
+7 -5
View File
@@ -618,13 +618,14 @@ async def process_messages_task():
endpoint = data.get("endpoint")
if endpoint:
# Schedule as a background task so processing the queue isn't stalled
asyncio.create_task(handle_telemetry_request(endpoint))
do_timeout = topic == "cmd/all"
asyncio.create_task(handle_telemetry_request(endpoint, do_timeout=do_timeout))
else:
print("[CloudMQTT] Received 'request_telemetry' but missing 'endpoint' field.")
else:
print(f"[CloudMQTT] Unknown action: {action}")
async def handle_telemetry_request(endpoint: str):
async def handle_telemetry_request(endpoint: str, do_timeout=True):
"""
Task to gather telemetry data (including structured systemd logs)
and post it to the target HTTP endpoint.
@@ -654,9 +655,10 @@ async def handle_telemetry_request(endpoint: str):
)
# 4. Wait for he microwave turn to send the telemetry data to the cloud endpoint
timeout = int(DEVICE_ID.split("_")[-1]) * config.TELEMETRY_SEND_INTERVAL
print(f"[Telemetry] Waiting for {timeout}s before sending telemetry to avoid collisions...")
await asyncio.sleep(timeout)
if do_timeout:
do_timeout = int(DEVICE_ID.split("_")[-1]) * config.TELEMETRY_SEND_INTERVAL
print(f"[Telemetry] Waiting for {do_timeout}s before sending telemetry to avoid collisions...")
await asyncio.sleep(do_timeout)
# 5. Offload blocking HTTP POST to thread pool
print(f"[Telemetry] Sending payload with {len(logs_list)} log entries...")