Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 54aa84a

Browse files
chore: feedback
1 parent 3fce51c commit 54aa84a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

agent/agentcontainers/api.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,14 +949,22 @@ func (api *API) handleDevcontainerRecreate(w http.ResponseWriter, r *http.Reques
949949
// The devcontainer state must be set to starting and the asyncWg must be
950950
// incremented before calling this function.
951951
func (api *API) CreateDevcontainer(workspaceFolder, configPath string, opts ...DevcontainerCLIUpOptions) error {
952-
api.asyncWg.Add(1)
953-
defer api.asyncWg.Done()
952+
api.mu.Lock()
953+
if api.closed {
954+
api.mu.Unlock()
955+
return nil
956+
}
954957

955958
dc, found := api.knownDevcontainers[workspaceFolder]
956959
if !found {
960+
api.mu.Unlock()
957961
return xerrors.Errorf("no devcontainer found")
958962
}
959963

964+
api.asyncWg.Add(1)
965+
defer api.asyncWg.Done()
966+
api.mu.Unlock()
967+
960968
var (
961969
err error
962970
ctx = api.ctx

0 commit comments

Comments
 (0)