From 42e455bd003fb69d3990be17ca45c39438b96ea9 Mon Sep 17 00:00:00 2001 From: "Enot (ded) Skelly" Date: Wed, 3 Jun 2026 14:05:58 -0700 Subject: [PATCH] add more broker connection timeout and retry defaults --- internal/ingest/ingest.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/ingest/ingest.go b/internal/ingest/ingest.go index a553fd8..4deaf3a 100644 --- a/internal/ingest/ingest.go +++ b/internal/ingest/ingest.go @@ -392,12 +392,18 @@ func (w *Worker) Start(ctx context.Context) { SetPassword(w.cfg.Password). SetAutoReconnect(true). SetMaxReconnectInterval(30 * time.Second). + SetKeepAlive(30 * time.Second). + SetPingTimeout(10 * time.Second). + SetConnectTimeout(15 * time.Second). + SetWriteTimeout(10 * time.Second). + SetConnectRetry(true). + SetConnectRetryInterval(5 * time.Second). SetOnConnectHandler(func(c mqtt.Client) { log.Printf("ingest[%s]: connected to %s", w.cfg.BrokerName, w.cfg.URL) w.subscribe(c) }). SetConnectionLostHandler(func(_ mqtt.Client, err error) { - log.Printf("ingest[%s]: connection lost: %v", w.cfg.BrokerName, err) + log.Printf("ingest[%s]: connection lost, will reconnect: %v", w.cfg.BrokerName, err) }) w.client = mqtt.NewClient(opts)