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:
Melody Becker 2025-06-11 15:55:52 +02:00
parent 29eda04330
commit 27b7d342b7
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
2 changed files with 35 additions and 24 deletions

View file

@ -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()
}