@ -307,13 +307,6 @@ func waitForFormatXL(firstDisk bool, endpoints Endpoints, setCount, drivesPerSet
return nil , err
}
// Done channel is used to close any lingering retry routine, as soon
// as this function returns.
doneCh := make ( chan struct { } )
// Indicate to our retry routine to exit cleanly, upon this function return.
defer close ( doneCh )
// prepare getElapsedTime() to calculate elapsed time since we started trying formatting disks.
// All times are rounded to avoid showing milli, micro and nano seconds
formatStartTime := time . Now ( ) . Round ( time . Second )
@ -321,13 +314,16 @@ func waitForFormatXL(firstDisk bool, endpoints Endpoints, setCount, drivesPerSet
return time . Now ( ) . Round ( time . Second ) . Sub ( formatStartTime ) . String ( )
}
// Wait on the jitter retry loop.
retryTimerCh := newRetryTimerSimple ( doneCh )
// Wait on each try for an update.
ticker := time . NewTicker ( 500 * time . Millisecond )
defer ticker . Stop ( )
var tries int
for {
select {
case retryCount := <- retryTimerCh :
format , err := connectLoadInitFormats ( retryCount , firstDisk , endpoints , setCount , drivesPerSet , deploymentID )
case <- ticker . C :
format , err := connectLoadInitFormats ( tries , firstDisk , endpoints , setCount , drivesPerSet , deploymentID )
if err != nil {
tries ++
switch err {
case errNotFirstDisk :
// Fresh setup, wait for first server to be up.