diff --git a/streamer/main.go b/streamer/main.go index 13f30f9..4a13553 100644 --- a/streamer/main.go +++ b/streamer/main.go @@ -30,7 +30,6 @@ func Execute(ctx context.Context, cfg config.Config) error { if err != nil { return err } - defer streamer.Stop(context.Background(), true) // setup a http server for our RPC API srv, err := NewGRPCServer(ctx, cfg, store, queue, cfg.IRC, streamer) @@ -62,6 +61,7 @@ func Execute(ctx context.Context, cfg config.Config) error { case <-ctx.Done(): return nil case err = <-errCh: + streamer.Stop(ctx, true) return err } } diff --git a/streamer/streamer.go b/streamer/streamer.go index 7724b37..2b9452c 100644 --- a/streamer/streamer.go +++ b/streamer/streamer.go @@ -98,6 +98,7 @@ func (s *Streamer) checkFDStore(ctx context.Context, store *fdstore.Store) { } if len(connEntries) > 0 { + zerolog.Ctx(ctx).Info().Msg("recovered an icecast connection") // grab the first entry conn = connEntries[0].Conn // close the rest @@ -132,6 +133,7 @@ func (s *Streamer) checkFDStore(ctx context.Context, store *fdstore.Store) { var entries []StreamTrack if current != nil { + zerolog.Ctx(ctx).Info().Msg("recovered the current song") entries = append(entries, StreamTrack{ QueueEntry: currentEntry, Audio: current, @@ -155,6 +157,7 @@ func (s *Streamer) checkFDStore(ctx context.Context, store *fdstore.Store) { continue } + zerolog.Ctx(ctx).Info().Msg("recovered an encoder song") entries = append(entries, StreamTrack{ QueueEntry: queueEntry, Audio: reader,