refactor(db): add constante for defaultTimeout

This commit is contained in:
2026-06-04 13:26:31 +02:00
parent 0f30749534
commit 2f7c88b701

View File

@@ -14,7 +14,10 @@ import (
mqtt "github.com/eclipse/paho.mqtt.golang" mqtt "github.com/eclipse/paho.mqtt.golang"
) )
const maxQoS = 2 const (
maxQoS = 2
defaultTimeout = 5 * time.Second
)
// A MqttParams is the abstracted MQTT gateway. // A MqttParams is the abstracted MQTT gateway.
// It provides the MQTT parameters to initialize the connection and the method to add data. // 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 { if p.Timeout == 0 {
// Set to default value // Set to default value
p.Timeout = time.Second * 5 p.Timeout = defaultTimeout
} }
opts := mqtt.NewClientOptions() opts := mqtt.NewClientOptions()