service/*: log error only if nil

This commit is contained in:
Simone Gotti 2019-07-04 15:50:37 +02:00
parent 0ec0a37fa3
commit 929a6fb654
5 changed files with 38 additions and 19 deletions

View File

@ -255,12 +255,17 @@ func (s *Configstore) Run(ctx context.Context) error {
case <-ctx.Done(): case <-ctx.Done():
log.Infof("configstore exiting") log.Infof("configstore exiting")
httpServer.Close() httpServer.Close()
return nil
case err := <-lerrCh: case err := <-lerrCh:
if err != nil {
log.Errorf("http server listen error: %+v", err) log.Errorf("http server listen error: %+v", err)
return err return err
}
case err := <-errCh: case err := <-errCh:
if err != nil {
log.Errorf("error: %+v", err) log.Errorf("error: %+v", err)
return err return err
} }
}
return nil
} }

View File

@ -1429,9 +1429,12 @@ func (e *Executor) Run(ctx context.Context) error {
case <-ctx.Done(): case <-ctx.Done():
log.Infof("runservice executor exiting") log.Infof("runservice executor exiting")
httpServer.Close() httpServer.Close()
return nil
case err := <-lerrCh: case err := <-lerrCh:
if err != nil {
log.Errorf("http server listen error: %v", err) log.Errorf("http server listen error: %v", err)
return err return err
} }
}
return nil
} }

View File

@ -333,9 +333,12 @@ func (g *Gateway) Run(ctx context.Context) error {
case <-ctx.Done(): case <-ctx.Done():
log.Infof("configstore exiting") log.Infof("configstore exiting")
httpServer.Close() httpServer.Close()
return nil
case err := <-lerrCh: case err := <-lerrCh:
if err != nil {
log.Errorf("http server listen error: %v", err) log.Errorf("http server listen error: %v", err)
return err return err
} }
}
return nil
} }

View File

@ -175,9 +175,12 @@ func (s *Gitserver) Run(ctx context.Context) error {
case <-ctx.Done(): case <-ctx.Done():
log.Infof("gitserver exiting") log.Infof("gitserver exiting")
httpServer.Close() httpServer.Close()
return nil
case err := <-lerrCh: case err := <-lerrCh:
if err != nil {
log.Errorf("http server listen error: %v", err) log.Errorf("http server listen error: %v", err)
return err return err
} }
}
return nil
} }

View File

@ -258,12 +258,17 @@ func (s *Runservice) Run(ctx context.Context) error {
case <-ctx.Done(): case <-ctx.Done():
log.Infof("runservice scheduler exiting") log.Infof("runservice scheduler exiting")
httpServer.Close() httpServer.Close()
return nil
case err := <-lerrCh: case err := <-lerrCh:
if err != nil {
log.Errorf("http server listen error: %v", err) log.Errorf("http server listen error: %v", err)
return err return err
}
case err := <-errCh: case err := <-errCh:
if err != nil {
log.Errorf("error: %+v", err) log.Errorf("error: %+v", err)
return err return err
} }
}
return nil
} }