fix: remove double call to server Close.

This commit is contained in:
Ludovic Fernandez 2019-12-09 15:14:06 +01:00 committed by Traefiker Bot
parent ddbf4470a1
commit 1a7a3a4233
3 changed files with 5 additions and 9 deletions

View file

@ -69,10 +69,10 @@ Complete documentation is available at https://traefik.io`,
err = cli.Execute(cmdTraefik) err = cli.Execute(cmdTraefik)
if err != nil { if err != nil {
stdlog.Println(err) stdlog.Println(err)
os.Exit(1) logrus.Exit(1)
} }
os.Exit(0) logrus.Exit(0)
} }
func runCmd(staticConfiguration *static.Configuration) error { func runCmd(staticConfiguration *static.Configuration) error {
@ -156,7 +156,6 @@ func runCmd(staticConfiguration *static.Configuration) error {
svr.Wait() svr.Wait()
log.WithoutContext().Info("Shutting down") log.WithoutContext().Info("Shutting down")
logrus.Exit(0)
return nil return nil
} }

View file

@ -49,8 +49,8 @@ func NewConfigurationWatcher(routinesPool *safe.Pool, pvd provider.Provider, pro
// Start the configuration watcher. // Start the configuration watcher.
func (c *ConfigurationWatcher) Start() { func (c *ConfigurationWatcher) Start() {
c.routinesPool.Go(func(stop chan bool) { c.listenProviders(stop) }) c.routinesPool.Go(c.listenProviders)
c.routinesPool.Go(func(stop chan bool) { c.listenConfigurations(stop) }) c.routinesPool.Go(c.listenConfigurations)
c.startProvider() c.startProvider()
} }

View file

@ -48,7 +48,6 @@ func NewServer(routinesPool *safe.Pool, entryPoints TCPEntryPoints, watcher *Con
// Start starts the server and Stop/Close it when context is Done // Start starts the server and Stop/Close it when context is Done
func (s *Server) Start(ctx context.Context) { func (s *Server) Start(ctx context.Context) {
go func() { go func() {
defer s.Close()
<-ctx.Done() <-ctx.Done()
logger := log.FromContext(ctx) logger := log.FromContext(ctx)
logger.Info("I have to go...") logger.Info("I have to go...")
@ -59,9 +58,7 @@ func (s *Server) Start(ctx context.Context) {
s.tcpEntryPoints.Start() s.tcpEntryPoints.Start()
s.watcher.Start() s.watcher.Start()
s.routinesPool.Go(func(stop chan bool) { s.routinesPool.Go(s.listenSignals)
s.listenSignals(stop)
})
} }
// Wait blocks until the server shutdown. // Wait blocks until the server shutdown.