Exit shim when shutdown manager is done

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2023-10-12 19:53:05 -07:00
parent a7333657af
commit 2486c12987

View File

@ -377,7 +377,7 @@ func run(ctx context.Context, manager Manager, name string, config Config) error
}
if err := serve(ctx, server, signals, sd.Shutdown); err != nil {
if err != shutdown.ErrShutdown {
if !errors.Is(err, shutdown.ErrShutdown) {
return err
}
}
@ -389,10 +389,10 @@ func run(ctx context.Context, manager Manager, name string, config Config) error
}
select {
case <-publisher.Done():
case <-sd.Done():
return nil
case <-time.After(5 * time.Second):
return errors.New("publisher not closed")
return errors.New("shim shutdown timeout")
}
}