mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-26 15:35:46 +00:00
* set keepalive ping
* made mutex more granular Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
ccf491d658
commit
c3bbf76dde
@ -56,7 +56,7 @@ func LazyLoadMonitorMQTTClient() {
|
||||
uri = "ssl://" + hostPort
|
||||
}
|
||||
|
||||
opts := mqtt.NewClientOptions().AddBroker(uri)
|
||||
opts := mqtt.NewClientOptions().AddBroker(uri).SetKeepAlive(60)
|
||||
opts.SetClientID(conf.ValidatorAddress + "-monitor")
|
||||
opts.SetUsername(conf.MqttUser)
|
||||
opts.SetPassword(conf.MqttPassword)
|
||||
@ -202,10 +202,12 @@ func (mms *MqttMonitor) MonitorActiveParticipants() {
|
||||
|
||||
func (mms *MqttMonitor) Log(msg string) {
|
||||
mms.contextMutex.Lock()
|
||||
if mms.sdkContext != nil {
|
||||
util.GetAppLogger().Info(*mms.sdkContext, msg)
|
||||
}
|
||||
localContext := mms.sdkContext
|
||||
mms.contextMutex.Unlock()
|
||||
if localContext != nil {
|
||||
util.GetAppLogger().Info(*localContext, msg)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (mms *MqttMonitor) SetContext(ctx sdk.Context) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user