From f3f50b0acef6d4f1dc2c2d9f08db95fde409fc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Sun, 5 Feb 2023 00:42:49 +0100 Subject: [PATCH] Fix race condition in create endpoint --- glue/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/glue/main.go b/glue/main.go index ef2bbcf..12ea6b6 100644 --- a/glue/main.go +++ b/glue/main.go @@ -231,6 +231,11 @@ func (p *Processor) Create(appTemplate apps.App) error { } } + err = container.Start() + if err != nil { + return fmt.Errorf("failed to start container: %v", err) + } + // Wait for the app to be created err = p.waitForApp() if err != nil { @@ -275,8 +280,7 @@ func (p *Processor) Create(appTemplate apps.App) error { } } - err = container.Start() - return fmt.Errorf("failed to start container: %v", err) + return nil } // Register registers app without creating a container for it