builder: delete sandbox in a goroutine for performance
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> (cherry picked from commit bcf1967dd0893b36c56c8c9b87c84246916484a1) Upstream-commit: 73911117b30ba74c42177b0f002bb4e98f2473f9 Component: engine
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/moby/buildkit/solver/pb"
|
||||
"github.com/moby/buildkit/util/network"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const networkName = "bridge"
|
||||
@@ -100,10 +101,10 @@ func (iface *lnInterface) Set(s *specs.Spec) {
|
||||
|
||||
func (iface *lnInterface) Close() error {
|
||||
<-iface.ready
|
||||
err := iface.sbx.Delete()
|
||||
if iface.err != nil {
|
||||
// iface.err takes precedence over cleanup errors
|
||||
return iface.err
|
||||
}
|
||||
return err
|
||||
go func() {
|
||||
if err := iface.sbx.Delete(); err != nil {
|
||||
logrus.Errorf("failed to delete builder network sandbox: %v", err)
|
||||
}
|
||||
}()
|
||||
return iface.err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user