with defer
This commit is contained in:
parent
f9109382cb
commit
5f89d83094
10
manager.go
10
manager.go
@ -35,6 +35,12 @@ type ComponentsAreReady struct {
|
||||
|
||||
func (m *Manager) RunNonBlocking(ctx context.Context, readyChan chan ComponentsAreReady) error {
|
||||
go func() error {
|
||||
defer func(ctx context.Context) {
|
||||
err := m.shutdown(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}(ctx)
|
||||
m.initLifetime()
|
||||
err := m.init(ctx)
|
||||
if err != nil {
|
||||
@ -53,10 +59,6 @@ func (m *Manager) RunNonBlocking(ctx context.Context, readyChan chan ComponentsA
|
||||
return err
|
||||
}
|
||||
|
||||
err = m.shutdown(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}()
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user