(ctx context.Context, reset time.Time)
| 2024 | } |
| 2025 | |
| 2026 | func sleepUntilResetWithBuffer(ctx context.Context, reset time.Time) error { |
| 2027 | buffer := time.Second |
| 2028 | timer := time.NewTimer(time.Until(reset) + buffer) |
| 2029 | select { |
| 2030 | case <-ctx.Done(): |
| 2031 | if !timer.Stop() { |
| 2032 | <-timer.C |
| 2033 | } |
| 2034 | return ctx.Err() |
| 2035 | case <-timer.C: |
| 2036 | } |
| 2037 | return nil |
| 2038 | } |
| 2039 | |
| 2040 | // When using roundTripWithOptionalFollowRedirect, note that it |
| 2041 | // is the responsibility of the caller to close the response body. |
no test coverage detected
searching dependent graphs…