Wait uses backoff retry for up to ~33s
()
| 140 | |
| 141 | // Wait uses backoff retry for up to ~33s |
| 142 | func (sw *StatWaiter) Wait() { |
| 143 | actualCount := sw.stat.Value() |
| 144 | if actualCount >= sw.targetCount { |
| 145 | return |
| 146 | } |
| 147 | |
| 148 | waitTime := 1 * time.Millisecond |
| 149 | for i := 0; i < 14; i++ { |
| 150 | waitTime *= 2 |
| 151 | time.Sleep(waitTime) |
| 152 | actualCount = sw.stat.Value() |
| 153 | if actualCount >= sw.targetCount { |
| 154 | return |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | sw.tb.Fatalf("StatWaiter.Wait timed out waiting for stat to reach %d (actual: %d) %s", sw.targetCount, actualCount, base.GetCallersName(2, true)) |
| 159 | } |
| 160 | |
| 161 | func AssertEqualBodies(t *testing.T, expected, actual Body) { |
| 162 | expectedCanonical, err := base.JSONMarshalCanonical(expected) |