refactor(db): add constante for defaultTimeout
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user