Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Luis Lucas authored and iknite committed Feb 19, 2019
1 parent 936dbd4 commit 2bf693b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions gossip/sender/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ func (s Sender) batcherSender(id int, ch chan *protocol.Snapshot, quit chan bool

case <-quit:
return
// default:
// fmt.Println("Doing nothing", id)
}
}
}
Expand Down Expand Up @@ -143,7 +141,7 @@ func (s Sender) Start(ch chan *protocol.Snapshot) {
for {
select {
case <-ticker.C:
log.Debug("QUEUE LENGTH: ", len(ch))
log.Debug("Messages in sender queue: ", len(ch))
case <-s.quit:
return
}
Expand Down
18 changes: 9 additions & 9 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,37 +234,37 @@ func (s *Server) Start() error {

if s.conf.EnableTLS {
go func() {
log.Debug(" * Starting QED API HTTPS server in addr: ", s.conf.HTTPAddr)
log.Debug(" * Starting API HTTPS server in addr: ", s.conf.HTTPAddr)
err := s.httpServer.ListenAndServeTLS(
s.conf.SSLCertificate,
s.conf.SSLCertificateKey,
)
if err != http.ErrServerClosed {
log.Errorf("Can't start QED API HTTP Server: %s", err)
log.Errorf("Can't start API HTTPS server: %s", err)
}
}()
} else {
go func() {
log.Debug(" * Starting QED API HTTP server in addr: ", s.conf.HTTPAddr)
log.Debug(" * Starting API HTTP server in addr: ", s.conf.HTTPAddr)
if err := s.httpServer.ListenAndServe(); err != http.ErrServerClosed {
log.Errorf("Can't start QED API HTTP Server: %s", err)
log.Errorf("Can't start API HTTP server: %s", err)
}
}()

}

go func() {
log.Debug(" * Starting QED MGMT HTTP server in addr: ", s.conf.MgmtAddr)
log.Debug(" * Starting management HTTP server in addr: ", s.conf.MgmtAddr)
if err := s.mgmtServer.ListenAndServe(); err != http.ErrServerClosed {
log.Errorf("Can't start QED MGMT HTTP Server: %s", err)
log.Errorf("Can't start management HTTP server: %s", err)
}
}()

log.Debugf(" ready on %s and %s\n", s.conf.HTTPAddr, s.conf.MgmtAddr)

if !s.bootstrap {
for _, addr := range s.conf.RaftJoinAddr {
log.Debug(" * Joining existent cluster QED MGMT HTTP server in addr: ", s.conf.MgmtAddr)
log.Debug(" * Joining existing QED cluster in addr: ", addr)
if err := join(addr, s.conf.RaftAddr, s.conf.NodeID); err != nil {
log.Fatalf("failed to join node at %s: %s", addr, err.Error())
}
Expand Down Expand Up @@ -313,13 +313,13 @@ func (s *Server) Stop() error {
log.Debugf("Done.\n")
}

log.Debugf("Stopping MGMT server...")
log.Debugf("Stopping management server...")
if err := s.mgmtServer.Shutdown(context.Background()); err != nil { // TODO include timeout instead nil
log.Error(err)
return err
}

log.Debugf("Stopping HTTP server...")
log.Debugf("Stopping API HTTP server...")
if err := s.httpServer.Shutdown(context.Background()); err != nil { // TODO include timeout instead nil
log.Error(err)
return err
Expand Down

0 comments on commit 2bf693b

Please sign in to comment.