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()