🔨 Fix `FastAPI People` workflow by YuriiMotov · Pull Request #14951 · fastapi/fastapi
Currently FastAPI People workflow fails due to hitting GitHub API rate limits.
After some experiments and googling I found out that the reason of hitting rate limits is in requests per query.
Since September rate limit rules became more complex and it's not recommended to make heavy queries (that return thousands of records).
To avoid hitting rate limits I:
- reduced the number of records fetched by query (30 discussions instead of 100)
- added a rate limiter that respects different types of limits:
- pauses if the number of remaining points is less than needed for request
- respects safe time intervals between requests (interval time is calculated from the limitation of 5000 points per hour and the number of points used by each request)
This way script will take more time to fetch data, but we will likely avoid hitting rate limits
If we need it, we can experiment with the speed by setting speed_multiplier ENV variable (defaults to 1, that is the spread with which we will spend 84 points per minute (5000 points per hour divided by 60 minutes)).