pinpox / base16-universal-manager

A universal manager to set base16 themes for any supported application
https://github.com/chriskempson/base16
MIT License
88 stars 20 forks source link

Github API rate limit makes first time installation impossible #60

Closed kristiangerkman closed 2 years ago

kristiangerkman commented 2 years ago

Hey,

I tried do clean install on this and it seems like the initial install panics due to githubs rate limit (which is 60 requests in one hour(?))

On top of that, you don't even get the first 60 installed, because the app panics when the first limited request hits.

Not sure if this can be worked around by installing the themes in batches, but in any case, the error handler has to be bettered so that the app doesn't panic when the rate limit hits - Or at least there needs to be some clarity on why the error happens.

You can get your rate quota with: curl https://api.github.com/rate_limit (core object)

It returns:

{
  "resources": {
    "core": {
      "limit": 60,
      "remaining": 0,
      "reset": 1652448505,
      "used": 60,
      "resource": "core"
    },
...
}
pinpox commented 2 years ago

Have you set a token as described in https://github.com/pinpox/base16-universal-manager#github-token-optional ?

kristiangerkman commented 2 years ago

I might have created an issue too soon.. I now tested with the token and it worked.

I based my assumption on curl -u "user:pass" https://api.github.com/rate_limit which returned the same quota amounts as unauthenticated:

    "core": {
      "limit": 60,
      "remaining": 60,
      "reset": 1652448505,
      "used": 0,
      "resource": "core"
    },

But after that I generated a token and used it, I checked what the tokens quota was and I had only used 9 of the 60 requests. :man_shrugging:

curl --oauth2-bearer "ghp_token" https://api.github.com/rate_limit

    "core": {
      "limit": 60,
      "remaining": 51,
      "reset": 1652885389,
      "used": 9,
      "resource": "core"
    },

So in conclusion, use the ghp token if you face this issue. :smile: