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

ratelimits: always use a pointer for limit #7804

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Nov 12, 2024

The zero value for limit is invalid, so returning nil in error cases avoids silently returning invalid limits (and means that if code makes a mistake and references an invalid limit it will be an obvious clear stack trace).

This is more consistent, since the methods on limit use a pointer receiver. Also, since limit is a fairly large object, this saves some copying.

Related to #7803 and #7797.

The zero value for `limit` is invalid, so returning `nil` in error cases avoids
silently returning invalid limits (and means that if code makes a mistake and
references an invalid limit it will be an obvious clear stack trace).

This is more consistent, since the methods on `limit` use a pointer
receiver. Also, since `limit` is a fairly large object, this saves some copying.
@jsha jsha requested a review from a team as a code owner November 12, 2024 22:33
@jsha jsha requested a review from aarongable November 12, 2024 22:33
@aarongable aarongable merged commit 20fdcbc into main Nov 15, 2024
12 checks passed
@aarongable aarongable deleted the limit-is-a-pointer branch November 15, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants