Skip to content

Commit 4a9a1c1

Browse files
committed
lxd/storage: try to bring up pools more aggressively at first
Signed-off-by: Simon Deziel <[email protected]>
1 parent 90b7a66 commit 4a9a1c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lxd/storage.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ func storageStartup(s *state.State) error {
120120
// periodically try to initialize them again in the background.
121121
if len(initPools) > 0 {
122122
go func() {
123+
delay := 5 * time.Second // first delay
124+
step := 5 * time.Second // increment per iteration
125+
maxDelay := time.Minute // cap at 60s
126+
123127
for {
124-
t := time.NewTimer(time.Duration(time.Minute))
128+
t := time.NewTimer(delay)
125129

126130
select {
127131
case <-s.ShutdownCtx.Done():
@@ -164,6 +168,13 @@ func storageStartup(s *state.State) error {
164168
return // Our job here is done.
165169
}
166170
}
171+
172+
if delay < maxDelay {
173+
delay += step
174+
if delay > maxDelay {
175+
delay = maxDelay
176+
}
177+
}
167178
}
168179
}()
169180
} else {

0 commit comments

Comments
 (0)