mirror of
https://github.com/ajvpot/meshexplorer.git
synced 2026-07-29 04:42:23 +02:00
ingest: make MQTT KeepAlive configurable (MQTT_KEEPALIVE_SECONDS)
As a near-silent subscriber, paho emits a PINGREQ roughly every KeepAlive seconds; lowering it sends client->server frames more often to keep the Cloudflare-proxied WebSocket path warm in both directions, a lever for the residual mid-stream "pingresp not received" stalls on the letsmesh broker. Default unchanged (30s); wired through docker-compose. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,7 @@ services:
|
||||
- MQTT_BROKERS=${MQTT_BROKERS}
|
||||
- MQTT_CLIENT_ID=${MQTT_CLIENT_ID:-meshcore-ingest}
|
||||
- MQTT_STALE_AFTER_SECONDS=${MQTT_STALE_AFTER_SECONDS:-300}
|
||||
- MQTT_KEEPALIVE_SECONDS=${MQTT_KEEPALIVE_SECONDS:-30}
|
||||
- MQTT_PING_TIMEOUT_SECONDS=${MQTT_PING_TIMEOUT_SECONDS:-20}
|
||||
- MESHCORE_BATCH_FLUSH_SECONDS=${MESHCORE_BATCH_FLUSH_SECONDS:-10}
|
||||
- MESHCORE_BATCH_MAX_ROWS=${MESHCORE_BATCH_MAX_ROWS:-5000}
|
||||
|
||||
@@ -146,7 +146,10 @@ func (d *Daemon) connectToBroker(broker MQTTBrokerConfig, idx int, maxRetries in
|
||||
opts.SetConnectRetry(true)
|
||||
opts.SetConnectTimeout(10 * time.Second)
|
||||
opts.SetMaxReconnectInterval(30 * time.Second)
|
||||
opts.SetKeepAlive(30 * time.Second)
|
||||
// As a near-silent subscriber we send a PINGREQ roughly every KeepAlive
|
||||
// seconds; lowering it keeps the Cloudflare WebSocket path warm in the
|
||||
// client->server direction (a lever for the residual mid-stream stalls).
|
||||
opts.SetKeepAlive(time.Duration(GetEnvIntOrDefault("MQTT_KEEPALIVE_SECONDS", 30)) * time.Second)
|
||||
// Allow extra margin for PINGRESP to survive the Cloudflare WebSocket
|
||||
// proxy's buffering/jitter; 10s was tight and produced false
|
||||
// "pingresp not received" disconnects. Configurable for tuning.
|
||||
|
||||
Reference in New Issue
Block a user