Skip to content
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

Provide better documentation #556

Open
payne911 opened this issue Jan 8, 2023 · 3 comments
Open

Provide better documentation #556

payne911 opened this issue Jan 8, 2023 · 3 comments
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Documentation Improvements or additions to documentation

Comments

@payne911
Copy link

payne911 commented Jan 8, 2023

There are only 2 utility functions (onRateLimit and onSecondaryRateLimit) to define to use this library, yet they remain relatively cryptic despite the example provided in the README.

  • What is the relationship between those 2 functions?
  • When are those 2 functions respectively called?
  • How does the returned value affect their execution?
  • What are all the "sub-parameters" of the options parameter?
  • Which of those parameters have default values, and what are those values?

Currently, it seems like I can mostly only imply these:

  1. onRateLimit will execute a retry if it returns true (but what about false? and what onSecondaryRateLimit?)
  2. retryAfter uses the seconds as its time unit (why not include that information directly in the variable name? as per its name, this could even be interpreted as being a boolean we could use to trigger yet another retry)
  3. retryCount is a counter which starts at 0 and gets incremented by 1 after onRateLimit is called
  4. options contains at least 2 values: url and method (but what even is method?)

There is already #76 but it seems to mostly relate to GHE (and it's been open for so long anyways). Personally, I built a tool that extensively relies on plugin-throttling and I would assume most of my users are non-GHE, so I'm creating this issue to hopefully cover my case as well.

@kfcampbell kfcampbell added Type: Documentation Improvements or additions to documentation Priority: Normal Status: Up for grabs Issues that are ready to be worked on by anyone labels Jan 11, 2023
@payne911
Copy link
Author

As per a recent PR, this doc link already provides a bit more info: https://octokit.github.io/rest.js/v19#throttling

Maybe it should be somehow integrated in the README.

@nickfloyd nickfloyd added the hacktoberfest Issues for participation in Hacktoberfest label Sep 20, 2023
@hoshsadiq
Copy link

Just ran into this as well, some additional information on this that might help understand at least some of your question can be found on the GH docs.

@wolfy1339
Copy link
Member

I recently added some more type information to the onRateLimit and onSecondaryRateLimit, and internal functions.

That should satisfy the needs for the options parameter.

The method key of the options parameter is the HTTP method of the request, ie POST

As mentioned, this all relates to the GitHub docs, https://docs.github.com/en/rest/overview/rate-limits-for-the-rest-api?apiVersion=2022-11-28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issues for participation in Hacktoberfest Status: Up for grabs Issues that are ready to be worked on by anyone Type: Documentation Improvements or additions to documentation
Projects
Status: 🔥 Backlog
Development

No branches or pull requests

5 participants