Manager: allow requesting shutdown multiple times
It's fine to request a shutdown multiple times. This fixes a hard crash due to a panic.
This commit is contained in:
parent
73f98f93a0
commit
b35af5de9f
@ -83,6 +83,11 @@ func (f *Flamenco) WaitForShutdown(ctx context.Context) bool {
|
||||
// requestShutdown closes the 'done' channel, signalling to callers of
|
||||
// WaitForShutdown() that a shutdown is requested.
|
||||
func (f *Flamenco) requestShutdown() {
|
||||
defer func() {
|
||||
// Recover the panic that happens when the channel is closed multiple times.
|
||||
// Requesting a shutdown should be possible multiple times without panicing.
|
||||
recover()
|
||||
}()
|
||||
close(f.done)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user