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

Added request options for DataSource retry info #970

Merged
merged 2 commits into from
Jan 23, 2020

Conversation

jcranendonk
Copy link
Contributor

The DataSource for a Model has no insight into the retry mechanism for get and set requests. This PR adds the retry count as one of a set of request options that are passed to DataSource.get and DataSource.set, so that this information may be used to e.g. manage request balancing and load shedding on the underlying network resource.

@coveralls
Copy link

coveralls commented Jan 22, 2020

Coverage Status

Coverage increased (+0.02%) to 92.616% when pulling c540f75 on jcranendonk:ds_retry_info into 1f6f304 on Netflix:master.

@@ -17,7 +17,7 @@ module.exports = function setRequestCycle(model, observer, groups,
var requestedPaths = requestedAndOptimizedPaths.requestedPaths;

// we have exceeded the maximum retry limit.
if (count === model._maxRetries) {
if (count > model._maxRetries) {

Choose a reason for hiding this comment

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

Just asking considering the original comparison logic, should this be >=?

Copy link
Contributor Author

@jcranendonk jcranendonk Jan 23, 2020

Choose a reason for hiding this comment

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

I made the change to align the retry counts with getRequestCycle; one started at 0, the other at 1. Now they both start at 1, which lines up better with the Zuul retry header value.

Copy link

@tquetano-netflix tquetano-netflix left a comment

Choose a reason for hiding this comment

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

Other than the one question posed, LGTM.

@@ -84,7 +84,7 @@ SetResponse.prototype._subscribe = function _subscribe(observer) {

// Starts the async request cycle.
return setRequestCycle(
model, observer, groups, isJSONGraph, isProgressive, 0);
model, observer, groups, isJSONGraph, isProgressive, 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tquetano-netflix The initial value was changed here, in coordination with the retry logic condition.

We can always use an object again if additional parameters become
necessary.
@jcranendonk jcranendonk merged commit 45f4776 into Netflix:master Jan 23, 2020
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