Skip to content

Commit

Permalink
Log server-sent retry times for acquire-job backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
moskyb committed Jan 14, 2025
1 parent 720f4b1 commit 3091b29
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ func (c *Client) AcquireJob(ctx context.Context, jobID string) (*api.Job, error)
}

func handleRetriableJobAcquisitionError(warning string, resp *api.Response, r *roko.Retrier, logger logger.Logger) {
logger.Warn("%s (%s)", warning, r)
// log the warning and the retrier state at the end of this function. if we logged the error before the call to
// `r.SetNextInterval`, the `Retrying in ...` message wouldn't include the server-set Retry-After, if it was set
defer func(r *roko.Retrier) { logger.Warn("%s (%s)", warning, r) }(r)

if resp != nil {
retryAfter := resp.Header.Get("Retry-After")

Expand Down

0 comments on commit 3091b29

Please sign in to comment.