mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
Make gce operation polling more robust.
Only fail the operation if we cannot poll it 3 consecutive times.
This commit is contained in:
parent
c752bc6ffb
commit
983748b2e2
@ -276,13 +276,19 @@ func (gce *GCECloud) targetPoolURL(name, region string) string {
|
||||
|
||||
func waitForOp(op *compute.Operation, getOperation func() (*compute.Operation, error)) error {
|
||||
pollOp := op
|
||||
consecPollFails := 0
|
||||
for pollOp.Status != "DONE" {
|
||||
var err error
|
||||
// TODO: add some backoff here.
|
||||
time.Sleep(time.Second)
|
||||
time.Sleep(3 * time.Second)
|
||||
pollOp, err = getOperation()
|
||||
if err != nil {
|
||||
return err
|
||||
if consecPollFails == 2 {
|
||||
// Only bail if we've seen 3 consecutive polling errors.
|
||||
return err
|
||||
}
|
||||
consecPollFails++
|
||||
} else {
|
||||
consecPollFails = 0
|
||||
}
|
||||
}
|
||||
if pollOp.Error != nil && len(pollOp.Error.Errors) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user