This repository has been archived by the owner on Jan 25, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.