forked from Ivasoft/device-mapping-manager
Retry CGroup detection using pid
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
14
main.go
14
main.go
@@ -15,6 +15,7 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
@@ -99,10 +100,17 @@ func listenForMounts() {
|
||||
panic(err)
|
||||
} else {
|
||||
pid := info.State.Pid
|
||||
version, err := cgroup.GetDeviceCGroupVersion("/", pid)
|
||||
|
||||
var version int
|
||||
var err error
|
||||
for i := 0; i < 20; i++ {
|
||||
version, err = cgroup.GetDeviceCGroupVersion("/", pid)
|
||||
if err == nil {
|
||||
break
|
||||
} else {
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
log.Printf("The cgroup version for process %d is: %v\n", pid, version)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user