Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move retry backoff behavior into separate middleware #313

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

advayakrishna
Copy link
Contributor

@advayakrishna advayakrishna commented Jun 6, 2022

Before this PR

It's difficult to reason about and modify URI selection or retry behavior because the functionality has been coupled in the RequestRetrier. RequestRetrier as currently implemented is responsible for several things:

  • Determining if a response can be retried
  • Choosing the URI for the next attempt
  • Implementing backoff behavior

This change simplifies backoff behavior and separates it into an independent middleware to begin cleaning this up.

After this PR

==COMMIT_MSG==
Move retry backoff behavior into separate middleware
==COMMIT_MSG==

Possible downsides?


This change is Reviewable

@changelog-app
Copy link

changelog-app bot commented Jun 6, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Move retry backoff behavior into separate middleware

Check the box to generate changelog(s)

  • Generate changelog entry

Copy link
Contributor

@bmoylan bmoylan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 7 files at r1, 3 of 3 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @advayakrishna)


conjure-go-client/httpclient/client.go line 201 at r3 (raw file):

	// call Next once so that the first repeated URI has backoff
	retrier.Next()
	return internal.NewBackoffMiddleware(func() {

nit: internal.NewBackoffMiddleware(retrier.Next)


conjure-go-client/httpclient/internal/request_retrier.go line 108 at r3 (raw file):

}

func isNonRetryableClientError(resp *http.Response, errCode int) bool {

nit: should this and isSuccess be in the neighboring retry.go file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants