-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: limit API calls when generating parachain #299
Conversation
@brunopgalvao , could we incorporate this into the documentation? |
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #299 +/- ##
==========================================
- Coverage 70.28% 70.26% -0.03%
==========================================
Files 52 53 +1
Lines 8657 9131 +474
Branches 8657 9131 +474
==========================================
+ Hits 6085 6416 +331
- Misses 1636 1731 +95
- Partials 936 984 +48
|
LGTM When running Added to Pop Docs. |
Good idea. What do you think is the best way to go about it? Maybe a note? |
Yes, a note in the output with what was verified would be nice. Example:
|
I added the note that way, I like it |
In the
pop new parachain
command, we perform several sequential operations to gather repository information based on the user's selection:This process results in a total of five API calls before we even generate the parachain. If the user performs this operation twice in a short period, it results in 10 API calls, which could quickly hit rate limits on the API:
The limit per hour seems high enough 60 requests per hour, but it seems it also restricts the call per minute.
I reached the limit while working on an integration which means I got stuck and can generate more parachains for a certain period of time. Same happened to another user: #237 (comment)
Solution
By default, the command won't fetch the
license
(since it's unlikely to change and can be hardcoded) or thecommit hashes
, cutting the API queries down to just one. If users still want to verify this info, they can use the--verify
flag. This approach keeps the "Don't Trust, Verify" principle intact while reducing API calls for most users, making parachain generation smoother and avoiding rate limit issues.I couldn’t find a way to fetch all the information in a single call, which would be ideal, so I think this is the best approach for now. However, I’m open to other ideas if you have any suggestions.
Closes: #237