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

Fix Retry-After in clients #26874

Merged
merged 1 commit into from
Jun 8, 2016

Conversation

wojtek-t
Copy link
Member

@wojtek-t wojtek-t commented Jun 6, 2016

Fix #26871

@wojtek-t wojtek-t added kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Jun 6, 2016
@wojtek-t wojtek-t added this to the v1.3 milestone Jun 6, 2016
@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 6, 2016

@gmarek

@k8s-github-robot k8s-github-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-label-needed labels Jun 6, 2016
@dims
Copy link
Member

dims commented Jun 6, 2016

Looks good to me :)

@smarterclayton
Copy link
Contributor

What's the point of the backoff mgr now?

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 6, 2016

@smarterclayton - it's used in bunch of other places (e.g. line 807).

We may consider a different fix, but currently "Retry-After" simply doesn't work at all - see #26871

@smarterclayton
Copy link
Contributor

So maybe we shouldn't be using NoBackoff, we should be using a new
ZeroBackoff which does sleep, but always returns CalculateBackoff of 0.
That would then keep the paths unified. I think we would want retries to
be governed by a backoff abstraction (I think)>

On Mon, Jun 6, 2016 at 10:55 AM, Wojciech Tyczynski <
notifications@github.com> wrote:

@smarterclayton https://github.com/smarterclayton - it's used in bunch
of other places (e.g. line 807).

We may consider a different fix, but currently "Retry-After" simply
doesn't work at all - see #26871
#26871


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#26874 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABG_p8GOTtplinEt14ACqRnw55RcP2K2ks5qJDT8gaJpZM4IupKq
.

@krousey
Copy link
Contributor

krousey commented Jun 6, 2016

Maybe the backoff interface doesn't need Sleep at all because they should all call time.Sleep

However, in the test, I would like a way to stub out sleep with a function that can record the number of times it was called and with what arguments for testing. I don't want to introduce actual sleeps into the tests.

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 6, 2016

@krousey - your proposal sounds reasonable for me - I will fix the PR tomorrow.

@lavalamp lavalamp removed their assignment Jun 6, 2016
@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@krousey @smarterclayton - I changed it (not really as you suggested, but hopefully it's good enough).

PTAL

@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 7, 2016
@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@k8s-bot test this please, issue: #23545

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@k8s-bot e2e test this please, issue: #23545

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@k8s-bot e2e test this please, issue: #23545

@smarterclayton
Copy link
Contributor

Change LGTM (in terms of what we discussed)

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@k8s-bot test this please, issue: #23545

if len(b.expectedSleeps) != 0 {
b.t.Errorf("some sleeps weren't called: %v", b.expectedSleeps)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

testBackoffManager should probably just record the sleep calls and leave the verification to the caller. This would allow for more test specific verification, put the error messages in the test cases, and de-tangle this struct from a *testing.T member.

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@krousey - comments applied. PTAL

@wojtek-t wojtek-t added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Jun 7, 2016

func (b *testBackoffManager) Sleep(d time.Duration) {
if b.sleeps == nil {
b.sleeps = make([]time.Duration, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can append to a nil slice. No need to explicitly allocate.

@krousey
Copy link
Contributor

krousey commented Jun 7, 2016

One minor nit, but LGTM otherwise.

@wojtek-t
Copy link
Member Author

wojtek-t commented Jun 7, 2016

@krousey - thanks a lot for review - the last comment applied

@krousey krousey added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 7, 2016
@k8s-bot
Copy link

k8s-bot commented Jun 8, 2016

GCE e2e build/test passed for commit 528713b.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 85b67f2 into kubernetes:master Jun 8, 2016
@wojtek-t wojtek-t deleted the fix_retry_after branch June 15, 2016 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants