Skip to content

Commit ca4a4ec

Browse files
authored
In compile command try to release the package manager lock ASAP (#2741)
* In `compile` command try to release the package manager lock ASAP * Applied suggestion from code review
1 parent c3d05d6 commit ca4a4ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

commands/service_compile.go

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"io"
2323
"sort"
2424
"strings"
25+
"sync"
2526
"time"
2627

2728
"github.com/arduino/arduino-cli/commands/cmderrors"
@@ -81,6 +82,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
8182
if err != nil {
8283
return err
8384
}
85+
release = sync.OnceFunc(release)
8486
defer release()
8587

8688
if pme.Dirty() {
@@ -358,6 +360,10 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
358360
targetBoard.String(), "'build.board'", sketchBuilder.GetBuildProperties().Get("build.board")) + "\n"))
359361
}
360362

363+
// Release package manager
364+
release()
365+
366+
// Perform the actual build
361367
if err := sketchBuilder.Build(); err != nil {
362368
return &cmderrors.CompileFailedError{Message: err.Error()}
363369
}

0 commit comments

Comments
 (0)