Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Fix issue with exceeding rate limits #1892

Merged
merged 2 commits into from
Aug 6, 2023

Conversation

JosephTLyons
Copy link
Collaborator

This PR should fix the issue were having with exceeding GitHub's rate limits. The high-level overview of these changes is that instead of having to look through all issues and having to get the upvote counts for every issue after the fact, we just modify our github query to return the results already sorted by likes, then we only take the number of issues we care about (20 in this case). This required quite a bit of tweaks, but were blazing fast now and our execution time should not grow as the number of issues increases. We should be using only a handful of requests each time the script runs. We could potentially bump up our cron scheduling now, since lowering it to 12 hours was a quick fix to avoid this issue a long time ago.

I also did a bit of refactoring, since some functions were getting pretty long and hard to read.

It also makes a few small changes, like expecting the GITHUB_TOKEN as an env variable, rather than an arg to the script, and defaulting to dev mode. If you want prod mode, you have to opt into it.

@JosephTLyons JosephTLyons merged commit 55b8ce5 into main Aug 6, 2023
@JosephTLyons JosephTLyons deleted the fix-issue-with-exceeding-rate-limits branch August 6, 2023 21:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant