OAI / tools.openapis.org

A collection of open-source and commercial tools for creating your APIs with OpenAPI - Sourced from and published for the community
https://tools.openapis.org/
96 stars 25 forks source link

feat: Introduced throttling on GitHub API calls #32

Closed SensibleWood closed 2 years ago

SensibleWood commented 2 years ago

This is a simple means for ensuring that calls to the GitHub API do not "swamp" the interface. Dispatching all API calls in one hit appears to cause sporadic 403s to be returned.

It uses the Bluebird Promise to access Promise.map and use the concurrency parameter to regulate the number of promises dispatched at any one time. The number is controlled by the GitHub Actions secret (no need to be a secret really, but this seemed the easiest way) GH_API_CONCURRENCY_LIMIT. This value can therefore be tweaked as required without necessitating a code change.