Skip to content

Commit

Permalink
Add more information to nats timeout error logs (#151)
Browse files Browse the repository at this point in the history
* Add more information to nats timeout error logs
  • Loading branch information
victor-carvalho authored Dec 10, 2020
1 parent 194b1b3 commit fc1440c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion cluster/etcd_service_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,13 @@ func (sd *etcdServiceDiscovery) watchEtcdChanges() {
go func(chn clientv3.WatchChan) {
for sd.running {
select {
case wResp := <-chn:
case wResp, ok := <-chn:
if wResp.Err() != nil {
logger.Log.Warnf("etcd watcher response error: %s", wResp.Err())
}
if !ok {
logger.Log.Error("etcd watcher died")
}
for _, ev := range wResp.Events {
svType, svID, err := parseEtcdKey(string(ev.Kv.Key))
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions service/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ func (r *RemoteService) remoteProcess(
switch msg.Type {
case message.Request:
if err != nil {
logger.Log.Errorf("Failed to process remote: %s", err.Error())
logger.Log.Errorf("Failed to process remote server with id %s and hostname %s: %s", server.ID, server.Hostname, err.Error())
a.AnswerWithError(ctx, msg.ID, err)
return
}
err := a.Session.ResponseMID(ctx, msg.ID, res.Data)
if err != nil {
logger.Log.Errorf("Failed to respond remote: %s", err.Error())
logger.Log.Errorf("Failed to respond to remote server with id %s and hostname %s: %s", server.ID, server.Hostname, err.Error())
a.AnswerWithError(ctx, msg.ID, err)
}
case message.Notify:
Expand All @@ -113,7 +113,7 @@ func (r *RemoteService) remoteProcess(
err = errors.New(res.Error.GetMsg())
}
if err != nil {
logger.Log.Errorf("error while sending a notify: %s", err.Error())
logger.Log.Errorf("error while sending a notify to server with id %s and hostname %s: %s", server.ID, server.Hostname, err.Error())
}
}
}
Expand Down

0 comments on commit fc1440c

Please sign in to comment.