1
0
Fork 0

Request in goroutine

main
Jordan Hotmann 2023-12-06 22:30:51 -07:00
parent 45192b0c1c
commit fe87cd50c7
No known key found for this signature in database
GPG Key ID: 01B504170C2A2EA3
2 changed files with 2 additions and 3 deletions

View File

@ -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)
}
}
}

View File

@ -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
}
}