Skip to main content

Why am I hitting my repository API limit?

This article helps you find out why Gearset is consuming so many source control provider (VCS) API requests and how to reduce them.

Richard Terry avatar
Written by Richard Terry
Updated over 4 weeks ago

Gearset Pipelines integrates with your source control system (e.g. Github/Gitlab) and we make use of the public APIs that these systems provide in order to retrieve details about pull requests that are open within your pipeline.

Every source control provider has a limit of how many API requests you can make per hour/day.

Occasionally, you might find that some of the requests we make to your source control provider fail due to these limits and this may limit your interaction with your repository in Gearset, this includes using your Gearset Pipeline.

This is most common with BitBucket as it has the lowest request limit at 1000 requests per hour per team.

Why am I running over the API limit?

Large number of open pull requests

When we load up your pipeline, we need to show you details of your open pull requests. If you have a large number of pull requests open, this can contribute to us hitting rate limits.

Closing off any stale pull requests that have been open but are not being progressed can be a useful first step. We will provide a warning message when you have a very large number of open pull requests, but it is good to keep on top of this.

Solution

Check if you actually need all of your open pull requests, if you can lower this number, Gearset will spend less of your requests on checking in on open pull requests.

Several of the VCS providers have mechanisms that can be used to flag stale pull requests for assessment, or even automatically closing them.

Good places to start

  • Sometimes there are pull requests left over from projects that are over and no longer needed.

  • If you setup a test pipeline, there may be a number of open pull requests that you never closed.

  • Check your back propagation. You may have an environment that has been left alone and has accumulated a large number of back propagation requests

Multiple browser tabs

While you are viewing your pipeline in a browser, we regularly poll for updated information about the open pull requests.

This will be happening for each browser tab you have open with a pipeline window showing. While tabs that are not active will poll your repo less frequently, minimising the number of open tabs/windows that are sitting on your pipeline can help to keep the number of API requests down.

If you have a few employees with multiple tabs open this can consume a considerable number of API requests.

Solution

Try to keep the number of open tabs within Pipelines view down to a minimum if you are running into issues with your API request limit.

Ensure that you are using a service account as the pipeline owner

We generally recommend setting up your pipeline using a team shared account. When doing this, we also recommend that you use a service account as the owner, rather than one of your users.

We take a number of actions on behalf of the pipeline owner when, for example, we receive webhook notifications that there have been changes in your VCS provider.

As the rate limits that the VCS providers impose are usually at a user level, having the service account as one of your active users means that the amount of requests we can make will be shared across all of these actions.

Solution

Advice on how to convert a pipeline from a user owned pipeline to a team shared on can be found here.

Still having issues?

If you are still having issues with API hitting your git repositories API limit, reach out in the in-app chat and we'll be happy to advise further.

Note: Gearset is currently working on a project to reduce the number of API requests we make. When complete, it will hopefully reduce the impact of this issue or remove it entirely.

Did this answer your question?