From 2f7c88b7013e323b3c9a9d7b4331277c2c7c930d Mon Sep 17 00:00:00 2001 From: Klagarge Date: Thu, 4 Jun 2026 13:26:31 +0200 Subject: [PATCH] refactor(db): add constante for defaultTimeout --- db/src/mqtt/mqtt.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/db/src/mqtt/mqtt.go b/db/src/mqtt/mqtt.go index c6e6968..3cf2b22 100644 --- a/db/src/mqtt/mqtt.go +++ b/db/src/mqtt/mqtt.go @@ -14,7 +14,10 @@ import ( mqtt "github.com/eclipse/paho.mqtt.golang" ) -const maxQoS = 2 +const ( + maxQoS = 2 + defaultTimeout = 5 * time.Second +) // A MqttParams is the abstracted MQTT gateway. // It provides the MQTT parameters to initialize the connection and the method to add data. @@ -77,7 +80,7 @@ func NewMqttGateway(p MqttParams) (*MqttGateway, error) { if p.Timeout == 0 { // Set to default value - p.Timeout = time.Second * 5 + p.Timeout = defaultTimeout } opts := mqtt.NewClientOptions()