mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
builder: delete sandbox in a goroutine for performance
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
1ad272c7e4
commit
bcf1967dd0
1 changed files with 7 additions and 6 deletions
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/moby/buildkit/solver/pb"
|
"github.com/moby/buildkit/solver/pb"
|
||||||
"github.com/moby/buildkit/util/network"
|
"github.com/moby/buildkit/util/network"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const networkName = "bridge"
|
const networkName = "bridge"
|
||||||
|
@ -100,10 +101,10 @@ func (iface *lnInterface) Set(s *specs.Spec) {
|
||||||
|
|
||||||
func (iface *lnInterface) Close() error {
|
func (iface *lnInterface) Close() error {
|
||||||
<-iface.ready
|
<-iface.ready
|
||||||
err := iface.sbx.Delete()
|
go func() {
|
||||||
if iface.err != nil {
|
if err := iface.sbx.Delete(); err != nil {
|
||||||
// iface.err takes precedence over cleanup errors
|
logrus.Errorf("failed to delete builder network sandbox: %v", err)
|
||||||
return iface.err
|
}
|
||||||
}
|
}()
|
||||||
return err
|
return iface.err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue