Skip to content

Commit 90b7a66

Browse files
committed
lxd/networks: try to bring up nets more aggressively at first
Signed-off-by: Simon Deziel <[email protected]>
1 parent 9439f20 commit 90b7a66

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lxd/networks.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1843,8 +1843,12 @@ func networkStartup(stateFunc func() *state.State, restoreOnly bool) error {
18431843
// periodically try to initialize them again in the background.
18441844
if remainingNetworksCount() > 0 {
18451845
go func() {
1846+
delay := 5 * time.Second // first delay
1847+
step := 5 * time.Second // increment per iteration
1848+
maxDelay := time.Minute // cap at 60s
1849+
18461850
for {
1847-
t := time.NewTimer(time.Duration(time.Minute))
1851+
t := time.NewTimer(delay)
18481852
s := stateFunc() // Get fresh state in case global config has been updated.
18491853

18501854
select {
@@ -1894,6 +1898,13 @@ func networkStartup(stateFunc func() *state.State, restoreOnly bool) error {
18941898
return // Our job here is done.
18951899
}
18961900
}
1901+
1902+
if delay < maxDelay {
1903+
delay += step
1904+
if delay > maxDelay {
1905+
delay = maxDelay
1906+
}
1907+
}
18971908
}
18981909
}()
18991910
} else {

0 commit comments

Comments
 (0)