feat: enable multi page star fetching for private vercel instances
This PR enables multi-page stars' support from fetching on private Vercel instances. This feature can be disabled on the public Vercel instance by adding the FETCH_SINGLE_PAGE_STARS=true as an env variable in the public Vercel instance. This variable will not be present when people deploy their own Vercel instance, causing the code to fetch multiple star pages.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated |
|---|---|---|---|---|
| github-readme-stats | ✅ Ready (Inspect) | Visit Preview | 💬 Add your feedback | Jan 21, 2023 at 5:31PM (UTC) |
Codecov Report
Base: 96.75% // Head: 96.90% // Increases project coverage by +0.15% :tada:
Coverage data is based on head (
84beb67) compared to base (c1dc7b8). Patch coverage: 100.00% of modified lines in pull request are covered.
:exclamation: Current head 84beb67 differs from pull request most recent head 5c5222d. Consider uploading reports for the commit 5c5222d to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #2159 +/- ##
==========================================
+ Coverage 96.75% 96.90% +0.15%
==========================================
Files 22 22
Lines 3883 3879 -4
Branches 329 337 +8
==========================================
+ Hits 3757 3759 +2
+ Misses 124 118 -6
Partials 2 2
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/fetchers/stats-fetcher.js | 93.06% <100.00%> (+2.05%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
As pointed out by @anuraghazra. Before we merge this, we have to make sure that the maxDuration limit of a private Vercel instance on the free plan is not being hit (see https://vercel.com/blog/customizing-serverless-functions).
@anuraghazra We can switch to FETCH_MULTI_PAGE_STARS=true and document that users can achieve more accurate results when they add this Vercel env parameter. Although less of a problem than in #2111 and #1691, we can also mention that for some users, this might lead to a Vercel timeout because of the maxDuration. Whatever you think is better.
The old code implemented in #2100 by @MatteoPierro performed one extra GraphQL API call. I improved upon this behaviour in f8b53f2. I think we are now good to merge since people can enable this feature on their own Vercel instance by adding the FETCH_MULTI_PAGE_STARS=true env variable while on the public instance, for now, it is disabled. This env variable would also allow us to create a GitHub action-based version that is more accurate. 🚀
@anuraghazra and @MatteoPierro can you please review the changes I made?