Skip to content

Commit 61676eb

Browse files
authored
Improve timeout behavior. (solo-io#169)
Instead of putting one timeout of 2 sec at the beginning of the check for the loop devices, use the already existing timeout implementation inside the loop and just increase the maximum timeout to 60 sec. This improves the overall behavior, because as soon as the loop devices are detected, the loop will be exited, but it also increases the maximum possible time to wait for the loop devices. This is helpful when being used on slower systems.
1 parent 9f1aa45 commit 61676eb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/builder/step_map_image.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func (s *stepMapImage) Run(_ context.Context, state multistep.StateBag) multiste
4848
loop := strings.Split(path, "/")[2]
4949
prefix := loop + "p"
5050

51-
time.Sleep(2 * time.Second)
5251
// Look for all partitions of created loopback
5352
var partitions []string
5453
cPartitions := make(chan []string)
@@ -95,7 +94,7 @@ func (s *stepMapImage) Run(_ context.Context, state multistep.StateBag) multiste
9594
n_j, _ := strconv.Atoi(partitions[j][len(partPrefix):])
9695
return n_i < n_j
9796
})
98-
case <-time.After(time.Second):
97+
case <-time.After(60*time.Second):
9998
cancel()
10099
}
101100

0 commit comments

Comments
 (0)