Fix more compiler errors, logic error in main
- Forgot to also update the undo handler for the inbox - Fixed main not ever returning if the debug server was not enabled
This commit is contained in:
parent
29eda04330
commit
27b7d342b7
2 changed files with 35 additions and 24 deletions
9
main.go
9
main.go
|
@ -110,13 +110,16 @@ func newServer() {
|
|||
}
|
||||
debugShutdownChan := make(chan *sync.WaitGroup, 1)
|
||||
interuptChan := make(chan os.Signal, 1)
|
||||
debugShutdownWaitgroup := sync.WaitGroup{}
|
||||
signal.Notify(interuptChan, os.Interrupt)
|
||||
|
||||
if *shared.FlagStartDebugServer {
|
||||
go func() {
|
||||
log.Info().Msg("Starting debug server")
|
||||
s := webdebug.New(*shared.FlagDebugPort)
|
||||
go func() {
|
||||
wg := <-debugShutdownChan
|
||||
wg.Add(1)
|
||||
if err := s.Stop(); err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to cleanly stop debug server")
|
||||
}
|
||||
|
@ -141,12 +144,10 @@ func newServer() {
|
|||
}()
|
||||
<-interuptChan
|
||||
log.Info().Msg("Received interrupt, shutting down")
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
debugShutdownChan <- &wg
|
||||
debugShutdownChan <- &debugShutdownWaitgroup
|
||||
if err = public.Stop(); err != nil {
|
||||
log.Fatal().Err(err).Msg("Failed to stop public server")
|
||||
}
|
||||
log.Info().Msg("Public server stopped")
|
||||
wg.Wait()
|
||||
debugShutdownWaitgroup.Wait()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue