+ if request.IsErrorThrottle(err) {
+ // Back off exponentially until a create call either
+ // succeeds or returns a non-throttle error.
+ d, _ := instanceSet.throttleDelay.Load().(time.Duration)
+ d = d*3/2 + time.Second
+ if d < throttleDelayMin {
+ d = throttleDelayMin
+ } else if d > throttleDelayMax {
+ d = throttleDelayMax
+ }
+ instanceSet.throttleDelay.Store(d)
+ return nil, rateLimitError{error: err, earliestRetry: time.Now().Add(d)}
+ } else if err != nil {
+ instanceSet.throttleDelay.Store(time.Duration(0))