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

Refactor waitAction #229

Merged
merged 1 commit into from Dec 10, 2019
Merged

Refactor waitAction #229

merged 1 commit into from Dec 10, 2019

Conversation

timoreimann
Copy link
Collaborator

This change refactors waitAction to use wait.PollUntil from the upstream apimachinery library to hide the underlying polling infrastructure and simplify the implementation.

We also exit the method if the context got cancelled while waiting for a response from the volume API. Previously, we would iterate through the for loop once again and possibly do another unnecessary API interaction if the ticker was ready again by that time.

Finally, we add a unit test (which required making the wait action timeout injectable).

The change passes both our local integration and upstream e2e tests.

This change refactors waitAction to use wait.PollUntil from the upstream
apimachinery library to hide the underlying polling infrastructure and
simplify the implementation.

We also exit the method if the context got cancelled while waiting for a
response from the volume API. Previously, we would iterate through the
for loop once again and possibly do another unnecessary API interaction
if the ticker was ready again by that time.

Finally, we add a unit test (which required making the wait action
timeout injectable).
defer cancel()

// TODO(arslan): use backoff in the future
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note to reviewers: I did not carry this TODO intentionally since backoffs for timeouts are implemented by the sidecars, and other kinds of errors we occasionally run into do not seem to warrant an exponential backoff as of today (e.g., temporary 4xx responses returned from the API that disappear on the next API call).

Copy link
Contributor

@adamwg adamwg left a comment

Choose a reason for hiding this comment

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

lgtm.

@timoreimann timoreimann merged commit 5d01103 into master Dec 10, 2019
@timoreimann timoreimann deleted the refactor-waitaction branch December 10, 2019 00:32
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.

None yet

2 participants