mirror of https://github.com/docker/buildx.git
commands: release the file lock before attempting to boot during create
If the boot command hung or took a long time, it blocked any read operations (such as `buildx ls`). When the boot happens, we no longer need to hold the file lock so we can release it. Releasing multiple times is legal and causes whichever release that is second to be a no-op so the defer is kept to ensure the lock is released even when an error condition happens. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This commit is contained in:
parent
da6662975f
commit
0878d5b22b
|
@ -72,6 +72,7 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Ensure the file lock gets released no matter what happens.
|
||||
defer release()
|
||||
|
||||
name := in.name
|
||||
|
@ -300,6 +301,10 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
// The store is no longer used from this point.
|
||||
// Release it so we aren't holding the file lock during the boot.
|
||||
release()
|
||||
|
||||
if in.bootstrap {
|
||||
if _, err = b.Boot(ctx); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue