cloudapi: prevent dangling manifest goroutines
When composer exits, it doesn't wait for the manifest generation goroutines to finish. This is generally a bad practice so let's introduce a bit of syncing and a new Shutdown method to prevent this. This also prevents the manifest generation goroutine from creating weird states when interrupted on a random line of code. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
02091ba777
commit
ba236180fc
4 changed files with 34 additions and 3 deletions
|
|
@ -330,7 +330,9 @@ func (c *Composer) Start() error {
|
|||
logrus.Info("Shutting down.")
|
||||
|
||||
if c.apiListener != nil {
|
||||
// First, close all listeners and then wait for all goroutines to finish.
|
||||
err := composerAPI.Shutdown(context.Background())
|
||||
c.api.Shutdown()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue