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

Replace 'abuse limit' with 'secondary limit' #455

Merged
merged 3 commits into from Mar 2, 2022

Conversation

oscard0m
Copy link
Member

Fixes #439

@ghost ghost added this to Inbox in JS Feb 12, 2022
@oscard0m oscard0m requested a review from gr2m February 12, 2022 16:58
@oscard0m oscard0m added the Type: Maintenance Tests, Refactorings, Automation, etc label Feb 12, 2022
@ghost ghost moved this from Inbox to Maintenance in JS Feb 12, 2022
@wolfy1339
Copy link
Member

This would be a breaking change, let's deprecate the "abuse" named methods and add new secondary rate limit named methods.

We can then remove these in a new major version once the new team is in place.

@oscard0m oscard0m force-pushed the replace-abuse-limit-with-secondary-limit branch from 97330ae to 4f81504 Compare February 13, 2022 18:57
@oscard0m oscard0m marked this pull request as draft February 13, 2022 19:09
@oscard0m oscard0m force-pushed the replace-abuse-limit-with-secondary-limit branch 3 times, most recently from e45018d to a36302d Compare February 13, 2022 19:49
src/index.ts Outdated
Comment on lines 108 to 111
deprecate(
state.onAbuseLimit,
"'onAbuseLimit' is deprecated, use 'onSecondaryRateLimit' instead"
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wolfy1339
This is the method you expected to be deprecated right?

Is util/deprecate good in this case??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the method you expected to be deprecated right?

Yes

Is util/deprecate good in this case??

That's a NodeJS only function. Octokit can be run in a browser environment.
Take example from this commit:
octokit/webhooks.js@f8f3d15

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change applied.
For the @deprecated annotation I think it has sense to improve types for octokitOptions so we can mark it as deprecated. What do you think @wolfy1339 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted a PR here: #457

src/index.ts Outdated
Comment on lines 73 to 71
minimumAbuseRetryAfter: 5,
minimumSecondaryRateRetryAfter: 5,
Copy link
Member Author

@oscard0m oscard0m Feb 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to replace property minimumAbuseRetryAfter with minimumSecondaryRateRetryAfter. I assume the plugin is in control of it and it's not expected to be passed as an option by the user.

Is my assumption correct?

@@ -98,7 +102,14 @@ export function throttling(octokit: Octokit, octokitOptions = {}) {
const events = {};
const emitter = new Bottleneck.Events(events);
// @ts-ignore
events.on("abuse-limit", state.onAbuseLimit);
events.on(
"secondary-limit",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming secondary-limit event will be sent from the L145 (so we have full control of the name). Is that correct or it should be listening to both (["abuse-limit", "secondary-limit"]?

test/events.test.ts Outdated Show resolved Hide resolved
@oscard0m oscard0m force-pushed the replace-abuse-limit-with-secondary-limit branch 2 times, most recently from 4231afb to 7241f93 Compare February 18, 2022 14:14
@oscard0m oscard0m force-pushed the replace-abuse-limit-with-secondary-limit branch from 7241f93 to 872d4a1 Compare February 18, 2022 14:33
@oscard0m oscard0m marked this pull request as ready for review February 18, 2022 14:34
Copy link
Member

@wolfy1339 wolfy1339 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@oscard0m oscard0m merged commit 4c45c2e into master Mar 2, 2022
@oscard0m oscard0m deleted the replace-abuse-limit-with-secondary-limit branch March 2, 2022 11:29
JS automation moved this from Maintenance to Done Mar 2, 2022
@gr2m
Copy link
Contributor

gr2m commented Mar 2, 2022

you merged it to master, but no new release was created, because semantic-release didn't understand the commit. I think this is a breaking change, right? Ideally we would keep supporting the previous APIs, but log a warning. Maybe that's something we could still do, to avoid a breaking change? I understand if you don't have the time for that though, releasing a breaking change is fine

Sorry for the late response, I don't have much time right now to help with Octokit 😫

@oscard0m
Copy link
Member Author

oscard0m commented Mar 2, 2022

you merged it to master, but no new release was created, because semantic-release didn't understand the commit.

Interesting. I'm going to take a look on why that happened. Commits look good to me in terms of semantic.

I think this is a breaking change, right? Ideally we would keep supporting the previous APIs, but log a warning. Maybe that's something we could still do, to avoid a breaking change?

I think we did the console.warn logic already. Maybe we missed something else you were expecting?

I understand if you don't have the time for that though, releasing a breaking change is fine

Once a week I have time to contribute to OSS. I have time tomorrow CET so... no problem 😉. I'm here to help and learn.

Sorry for the late response, I don't have much time right now to help with Octokit 😫

No worries at all. Whenever you have time is fine, no rush.

@gr2m
Copy link
Contributor

gr2m commented Mar 2, 2022

Commits look good to me in terms of semantic.

when you use "Squash & Merge", then the commit message defaults to the pull request title, if there is more than one commit.

I think we did the console.warn logic already. Maybe we missed something else you were expecting?

oh okay if you already have deprecation than it's all good. I think I usually use octokit.log.warn, I try to avoid using console. That way people can use their own log logic

@oscard0m
Copy link
Member Author

oscard0m commented Mar 2, 2022

when you use "Squash & Merge", then the commit message defaults to the pull request title, if there is more than one commit.

True. What's the process when we commit this mistake?

oh okay if you already have deprecation than it's all good. I think I usually use octokit.log.warn, I try to avoid using console. That way people can use their own log logic

Since we need to fix the commit message + release I can include octokit.log.warn

@gr2m
Copy link
Contributor

gr2m commented Mar 3, 2022

when you use "Squash & Merge", then the commit message defaults to the pull request title, if there is more than one commit.

True. What's the process when we commit this mistake?

Good question, we should document that, probably at https://github.com/octokit/octokit.js/blob/main/CONTRIBUTING.md#maintainers-only?

I would create an empty commit with the correct commit message & body, that will trigger the release without making any code changes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2022

🎉 This PR is included in version 3.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

nimadini added a commit to nimadini/octokit.js that referenced this pull request Aug 4, 2022
GitHub renamed `abuse limits` to `secondary rate limits` in 2021:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits

`@octokit/plugin-throttling` followed suit in March 2022, and released
version `3.6.0` with this new name (and deprecated `onAbuseLimit`):
octokit/plugin-throttling.js#455

This commit updates the README file to use the new name.
nimadini added a commit to nimadini/octokit.js that referenced this pull request Aug 4, 2022
GitHub renamed `abuse limits` to `secondary rate limits` in 2021:
https://docs.github.com/en/rest/overview/resources-in-the-rest-api#secondary-rate-limits

`@octokit/plugin-throttling` followed suit in March 2022, and released
version `3.6.0` with this new name (and deprecated `onAbuseLimit`):
octokit/plugin-throttling.js#455

This commit updates the codebase to use the new name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Tests, Refactorings, Automation, etc
Projects
No open projects
JS
  
Done
Development

Successfully merging this pull request may close these issues.

Replace "abuse" language with "secondary"
3 participants