зеркало из https://github.com/github/vitess-gh.git
worker: Simplify code which waits for enough health rdonly tablets to become available.
This commit is contained in:
Родитель
f86bb90119
Коммит
718260577c
|
@ -75,19 +75,20 @@ func FindHealthyRdonlyEndPoint(ctx context.Context, wr *wrangler.Wrangler, cell,
|
|||
}
|
||||
healthyEndpoints = append(healthyEndpoints, addr.EndPoint)
|
||||
}
|
||||
if len(healthyEndpoints) < *minHealthyEndPoints {
|
||||
deadlineForLog, _ := busywaitCtx.Deadline()
|
||||
wr.Logger().Infof("Waiting for enough endpoints to become available. available: %v required: %v Waiting up to %.1f more seconds.", len(healthyEndpoints), *minHealthyEndPoints, deadlineForLog.Sub(time.Now()).Seconds())
|
||||
// Block for 1 second because 2 seconds is the -health_check_interval flag value in integration tests.
|
||||
timer := time.NewTimer(1 * time.Second)
|
||||
select {
|
||||
case <-busywaitCtx.Done():
|
||||
timer.Stop()
|
||||
case <-timer.C:
|
||||
}
|
||||
} else {
|
||||
|
||||
if len(healthyEndpoints) >= *minHealthyEndPoints {
|
||||
break
|
||||
}
|
||||
|
||||
deadlineForLog, _ := busywaitCtx.Deadline()
|
||||
wr.Logger().Infof("Waiting for enough endpoints to become available. available: %v required: %v Waiting up to %.1f more seconds.", len(healthyEndpoints), *minHealthyEndPoints, deadlineForLog.Sub(time.Now()).Seconds())
|
||||
// Block for 1 second because 2 seconds is the -health_check_interval flag value in integration tests.
|
||||
timer := time.NewTimer(1 * time.Second)
|
||||
select {
|
||||
case <-busywaitCtx.Done():
|
||||
timer.Stop()
|
||||
case <-timer.C:
|
||||
}
|
||||
}
|
||||
|
||||
// random server in the list is what we want
|
||||
|
|
Загрузка…
Ссылка в новой задаче