-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add a local queue mechanism to the worker so it can retry sending heartbeat/status updates to the panel when the connection fails (e.g., panel temporarily unavailable). This ensures no data loss during outages.
Motivation
Currently, if the panel is down or unreachable, heartbeats are silently dropped. A retry queue would make the worker more resilient:
- Buffers updates locally (e.g., in-memory or SQLite).
- Retries on next successful connection.
- Prevents data gaps in monitoring history.
Proposed Implementation
- Queue Storage: Use a lightweight queue (e.g., in-memory array or persistent SQLite) to store failed payloads with timestamps.
- Retry Logic:
- On send failure: Enqueue payload with retry count (max 5-10).
- On successful connection: Flush queue oldest-first.
- Exponential backoff for retries (e.g., 1s → 5s → 30s).
- Config Options:
Option Type Default Description retryQueue.enabledboolean trueEnable/disable queue retryQueue.maxSizenumber 1000Max queued items retryQueue.persistencestring 'memory''memory' | 'sqlite'retryQueue.maxRetriesnumber 10Per-item retry limit
Example Flow
Worker detects downtime → Enqueue: {timestamp: now, status: {...}, retry: 1}
Panel back online → Retry queue → Send batched → Clear on success
Metadata
Metadata
Assignees
Labels
No labels