Request in goroutine
parent
45192b0c1c
commit
fe87cd50c7
|
@ -156,8 +156,7 @@ func handleMessages() {
|
|||
data, _ := json.Marshal(message.Event.Data)
|
||||
nats.Publish(fmt.Sprintf("homeassistant.zwave-scene.%s", message.Event.Data.DeviceId), data)
|
||||
case timerFinishedEventId:
|
||||
// nats.PublishString(fmt.Sprintf("homeassistant.%s.finished", message.Event.Data.EntityId), "finished")
|
||||
nats.PublishRequest(fmt.Sprintf("homeassistant.%s.finished", message.Event.Data.EntityId), []byte("finished"), 500*time.Millisecond, 3)
|
||||
go nats.PublishRequest(fmt.Sprintf("homeassistant.%s.finished", message.Event.Data.EntityId), []byte("finished"), 500*time.Millisecond, 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ func PublishRequest(subject string, message []byte, timeout time.Duration, retri
|
|||
resp, err := client.Conn.Request(subject, message, timeout)
|
||||
|
||||
if err == nil {
|
||||
logger.Debug("Request response received", "response", string(resp.Data))
|
||||
logger.Debug("Request response received", "response", string(resp.Data), "attempts", attempts)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue