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

Feature/sdk 15 #25

Merged
merged 5 commits into from
Jul 29, 2016
Merged

Feature/sdk 15 #25

merged 5 commits into from
Jul 29, 2016

Conversation

JeremyCraigMartinez
Copy link
Contributor

@JeremyCraigMartinez JeremyCraigMartinez commented Jul 29, 2016

New feature to add automatic retries to any API calls that end with the following errno's:

var RETRIABLE_ERRORS = [
    'ECONNRESET',
    'ENOTFOUND',
    'ESOCKETTIMEDOUT',
    'ETIMEDOUT',
    'ECONNREFUSED',
    'EHOSTUNREACH',
    'EPIPE',
    'EAI_AGAIN'
];

Issue originated from #12

//
// - **callback** (`Function`) - callback function with two parameters: `error` and `result`
//
var queryWithRetries = function (agent, authorization, contentType, contentLength, path, data, method, stringify, callback) {
Copy link

Choose a reason for hiding this comment

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

AFAIK: agent is the same through all the code base. So it can be just hardcoded and there will be no need to pass it as a parameter.
stringify, contentLength dont look like really necessary as a parameter as well.

Logic for authorization can be moved inside the function (like it was before).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • agent is a local variable to the object Session/Connect. It cannot be hard coded in this generalized function
  • Connection's query_api's content type is application/x-www-form-urlencoded which requires a different type of stringifying querystring.stringify, you can read more about this here. Session's query_api's content type is application/json which requires the stringying function JSON.stringify.
  • contentLength, see new commit

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.

2 participants