Financial-Times / nori

🍙 exploratory command-line tool to make changes across multiple repositories & track their progress
MIT License
11 stars 0 forks source link

We should throttle requests to the GitHub API #63

Closed sjparkinson closed 5 years ago

sjparkinson commented 5 years ago

We should use https://www.npmjs.com/package/@octokit/rest#throttling.

{ HttpError: You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later.
    at response.text.then.message (/Users/samuel.parkinson/Repositories/Financial-Times/transformation-runner/node_modules/@octokit/request/lib/request.js:56:27)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  name: 'HttpError',
  status: 403,
  headers:
   { 'access-control-allow-origin': '*',
     'access-control-expose-headers':
      'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
     connection: 'close',
     'content-encoding': 'gzip',
     'content-security-policy': "default-src 'none'",
     'content-type': 'application/json; charset=utf-8',
     date: 'Thu, 11 Apr 2019 13:47:50 GMT',
     'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
     server: 'GitHub.com',
     status: '403 Forbidden',
     'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
     'transfer-encoding': 'chunked',
     'x-accepted-oauth-scopes': '',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'deny',
     'x-github-media-type': 'github.inertia-preview; format=json',
     'x-github-request-id': '7BA5:09F8:10E6CC:308596:5CAF4586',
     'x-oauth-scopes': 'repo',
     'x-ratelimit-limit': '5000',
     'x-ratelimit-remaining': '4998',
     'x-ratelimit-reset': '1554994070',
     'x-xss-protection': '1; mode=block' },
  request:
   { method: 'POST',
     url:
      'https://api.github.com/repos/Financial-Times/n-zencoder/pulls',
     headers:
      { accept: 'application/vnd.github.inertia-preview+json',
        'user-agent': 'octokit.js/16.19.0 Node.js/11.13.0 (macOS Mojave; x64)',
        authorization: 'token [REDACTED]',
        'content-type': 'application/json; charset=utf-8' },
     body:
      '{"head":"unpin-ngage-patch","base":"master","title":"Unpin @financial-times/n-gage","body":""}',
     request: { validate: [Object] } },
  documentation_url: 'https://developer.github.com/v3/#abuse-rate-limits' }
sjparkinson commented 5 years ago

Sorted in #69.