reduce interface availability check interval
in order to reduce container startup times Closes #710.
This commit is contained in:
1 parent
e3e5934c51
commit
8dcdf8d314
1 file changed
+6
-2
@@ -6,12 +6,16 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
sleepTime = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
func EnsureInterface(ifaceName string, wait int) (iface *net.Interface, err error) {
|
||||
if iface, err = findInterface(ifaceName); err == nil || wait == 0 {
|
||||
return
|
||||
}
|
||||
for ; err != nil && wait > 0; wait-- {
|
||||
time.Sleep(1 * time.Second)
|
||||
for i := time.Duration(wait) * time.Second / sleepTime; err != nil && i > 0; i-- {
|
||||
time.Sleep(sleepTime)
|
||||
iface, err = findInterface(ifaceName)
|
||||
}
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user