retryAfterDuration returns the duration for the Retry-After header. In case of any errors, it returns 0 as if the header was never supplied.
(t string)
| 351 | // retryAfterDuration returns the duration for the Retry-After header. In case of any errors, it |
| 352 | // returns 0 as if the header was never supplied. |
| 353 | func retryAfterDuration(t string) time.Duration { |
| 354 | parsedDuration, err := time.Parse(http.TimeFormat, t) |
| 355 | if err == nil { |
| 356 | return time.Until(parsedDuration) |
| 357 | } |
| 358 | // The duration can be in seconds. |
| 359 | d, err := strconv.Atoi(t) |
| 360 | if err != nil { |
| 361 | return 0 |
| 362 | } |
| 363 | return time.Duration(d) * time.Second |
| 364 | } |
| 365 | |
| 366 | // writeStorage represents the storage for RemoteWriteHandler. |
| 367 | // This interface is intentionally private due its experimental state. |
no outgoing calls