Skip to content

Change decorator default from block=False to block=True #223

@jsocol

Description

@jsocol

Proposal: change the default from @ratelimit(block=False) to @ratelimit(block=True) in version 4.

Changes that would occur by default:

  • When stacking ratelimits, the first limit reached would block the request and subsequent ratelimits (lower in the stack) would not be counted. Thinking about the use case of burst limits, this is probably desirable.
  • Behavior would, I believe, become less surprising in common use cases.
  • The default would now be less ideal for ratelimiting login screens. While this is a common use case if you're using ratelimit in exactly one place, it is probably not the majority of use cases overall. And if you're setting it up in one place, you probably have some additional work to do there, anyway.

This would not impact core.is_ratelimited(), since that method does not have a block= argument.

I suspect a number of issues over the years have been filed due to the surprising behavior of not actually blocking requests by default.

I would like to hear input from users here to know if this would make the API more intuitive or upgrading too much of a pain. The upgrade steps would be, anywhere block= is not specified and the default behavior is desired, it would need to be changed. Anywhere block=True is specified would not need to be changed.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions