Skip to content

Support for 429 rate limit response #970

@theknut

Description

@theknut

When hitting a rate limit configured in the GitLab instance, the api throws a GitLabException

GitLabException: GitLab server returned an error (TooManyRequests): Response cannot be deserialized (429 - Too many requests, see: https://gitlab.example.com/settings/#rate-limits
). Original call: Get https://gitlab.example.com/api/v4/projects/:projectid/jobs/:jobid/trace

The retry-after header provides the wait time for the client. Please implement a retry after the specified timeout to handle rate limits.

Further links:
https://docs.gitlab.com/security/rate_limits/
https://docs.gitlab.com/administration/settings/user_and_ip_rate_limits/#response-headers (useful for clients)

Some existing API client implementations:
https://github.com/python-gitlab/python-gitlab/blob/3859aa0ff3a77b31651b770585f5cfe81c9d244a/gitlab…
https://github.com/jdalrymple/gitbeaker/blob/1724338a8b2bb195a0e90868fa35ef37d29f8ae3/packages/rest…
https://gitlab.com/gitlab-org/api/client-go/-/blob/main/gitlab.go#L608-704

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions