dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
200 stars 37 forks source link

GitHub Rate Limiting #137

Closed ianwremmel closed 1 year ago

ianwremmel commented 1 year ago

I don't think this is actually an issue with multi-semantic-release, but I imagine you're likely to have run into it and hopefully it could be addressed with documentation.

I'm running MSR against a repo with a very small number of packages (as of today, it's got 9 packages, it was 6 yesterday). I keep seeing the error You have exceeded a secondary rate limit. Please wait a few minutes before you try again. while semantic release runs against GitHub.

Just now, I also encountered a proper 429 during git checkout when rerunning the release job.

I'm authenticating using the GitHub Actions generated access token.

Have y'all seen this before? Are there any known workarounds?

ianwremmel commented 1 year ago

Ah, never mind. Looks like this is a known issue with sementic-release/github :(

https://github.com/semantic-release/github/issues/542 https://github.com/semantic-release/github/pull/487

antongolub commented 1 year ago

Hey, @ianwremmel,

All the Github API interaction logic is implemented on the side of semrel plugins. For example, semantic-release/github acts this way: it wraps Octokit client with Bottleneck. And here's its ratelimit constants, but I'm afraid I don't see any option to customise these values.

https://github.com/semantic-release/github/blob/master/lib/definitions/rate-limit.js

/**
 * Default exponential backoff configuration for retries.
 */
const RETRY_CONF = {retries: 3, factor: 2, minTimeout: 1000};

/**
 * Rate limit per API endpoints.
 *
 * See {@link https://developer.github.com/v3/search/#rate-limit|Search API rate limit}.
 * See {@link https://developer.github.com/v3/#rate-limiting|Rate limiting}.
 */
const RATE_LIMITS = {
  search: ((60 * 1000) / 30) * 1.1, // 30 calls per minutes => 1 call every 2s + 10% safety margin
  core: {
    read: ((60 * 60 * 1000) / 5000) * 1.1, // 5000 calls per hour => 1 call per 720ms + 10% safety margin
    write: 3000, // 1 call every 3 seconds
  },
};

/**
 * Global rate limit to prevent abuse.
 *
 * See {@link https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits|Dealing with abuse rate limits}
 */
const GLOBAL_RATE_LIMIT = 1000;

module.exports = {RETRY_CONF, RATE_LIMITS, GLOBAL_RATE_LIMIT};
ianwremmel commented 1 year ago

Yea, looks like folks have been trying to get this fixed for nearly a year :(

https://github.com/semantic-release/github/pull/487

Looks like it's time to dust off patch-package.