Skip to content

Rate limit errors #354

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

Merged
merged 8 commits into from
Jun 22, 2016
Merged

Conversation

divergentdave
Copy link
Contributor

@divergentdave divergentdave commented Jun 18, 2016

This fixes #348. So far I have added fixture data and failing tests.

@divergentdave divergentdave force-pushed the rate-limit-error branch 5 times, most recently from 08f260e to 103145e Compare June 19, 2016 16:57
@divergentdave
Copy link
Contributor Author

I think I have fixed the underlying problem in ad6be66; thanks to @clayreimann for the spot-on analysis. This has exposed a problem with the search tests, which are now failing. The Search API has its own rate limit, and I think the 403 errors are probably due to the four build jobs exhausting the limit. I'm going to mock out the search API too, with pre-recorded responses, to take care of this.

(I also noticed the issue milestone tests fail intermittently. This appears to be a race condition between the four test runners creating and deleting the same milestone.)

@@ -49,6 +49,7 @@
"debug": "^2.2.0",
"es6-promise": "^3.0.2",
"js-base64": "^2.1.9",
"nock": "^8.0.0",
Copy link
Member

Choose a reason for hiding this comment

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

This is used only in the test files, so it should be a devDependency not a dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 fixed

throw error;
}
});
}).catch(callbackErrorOrThrow(cb, path));
Copy link
Member

Choose a reason for hiding this comment

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

Looking at this again, I think you were on to something with this change in the first place, I think that perhaps it needed to be a bit more nuanced. Maybe something like:

.catch(function(error) {
  // we haven't processed this error yet
  if (!(error instanceof ResponseError)) {
    callbackErrorOrThrow(cb, path)(error);

  // we have already processed this error
  } else if (cb) {
    cb(error);
  } else {
    throw error
  }
});

Thoughts?

@clayreimann
Copy link
Member

@divergentdave thanks for the PR, should the tests be passing?

I also looked at your change to the catch on _requestAllPages and added a comment on 3c70db0, you may have been right the first time 'round.

@divergentdave
Copy link
Contributor Author

divergentdave commented Jun 20, 2016 via email

@divergentdave
Copy link
Contributor Author

Okay, 9ad8953 passes tests locally for me. (though some tests are flaky) I'm working on mocking out the search API requests, as described above, but I think the axios and nock libraries might be interfering with each other.

@divergentdave divergentdave changed the title WIP: Rate limit errors Rate limit errors Jun 22, 2016
@divergentdave
Copy link
Contributor Author

This is ready to go now. I figured out the search API fixtures, and I squashed some commits to clean up the history. Let me know if you have any questions!

if (object.hasOwnProperty('config')) {
const {status, statusText, config: {method, url}} = object;
let message = (`${status} error making request ${method} ` +
`${url}: "${statusText}"`);
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to break this into two lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@clayreimann clayreimann merged commit e264b01 into github-tools:master Jun 22, 2016
@clayreimann
Copy link
Member

@divergentdave Thanks for the great PR!

@divergentdave
Copy link
Contributor Author

divergentdave commented Jun 22, 2016 via email

@divergentdave divergentdave deleted the rate-limit-error branch June 23, 2016 00:52
@AurelioDeRosa
Copy link
Member

Thank you very much indeed!

outoftime added a commit to outoftime/popcode that referenced this pull request Oct 5, 2016
Prior to 2.4.0, certain errors are not handled correctly, resulting in
the reported error being an error in the error handler. This makes it
impossible to know what the original error was.

This was [fixed in 2.4.0](github-tools/github#354),
meaning we will now get meaningful error reports for errors when
interacting with the Gist API.

Apparently the 2.4.0 build failed, so there is no 2.4.0 on npm. For that
reason we include the dependency off of GitHub, which means `dist` isn't
built, which means we need to compile in the source files. So, a bit of
extra configuration in WebPack to compile ES6 and also to point at the
right module lookup paths.
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.

Error callback not firing when hitting rate limit
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy