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

@RateLimited should be repeatable #46

Open
mschorsch opened this issue Jul 3, 2023 · 3 comments
Open

@RateLimited should be repeatable #46

mschorsch opened this issue Jul 3, 2023 · 3 comments

Comments

@mschorsch
Copy link

mschorsch commented Jul 3, 2023

The @RateLimited annotation should be repeatable.

Example:

@RateLimited(bucket = "global")
@RateLimited(bucket = "per-user", identityResolver = IpResolver::class)
@ApplicationScoped
class MyClass {

    //...
}

see also: https://stackoverflow.com/questions/35951519/java-8-repeatable-custom-annotations

@mschorsch mschorsch changed the title RateLimited should be repeatable @RateLimited should be repeatable Jul 4, 2023
@rmanibus
Copy link
Contributor

rmanibus commented Dec 2, 2023

I think this is a valuable use case, but it can lead to some interesting edge cases:
in case we have multiple pods attached to a method
If one of the bucket is empty, should we still consume token from the other one ?
If multiple bucket are empty, what wait time are we returning ? (for this one, max function is probably fine)
Also, should we fail if the same bucket is attached multiple time to a method ?

@mschorsch
Copy link
Author

mschorsch commented May 6, 2024

If one of the bucket is empty, should we still consume token from the other one ?

No. As a user i would expect that If one condition ist not met then the request should fail.

If multiple bucket are empty, what wait time are we returning ? (for this one, max function is probably fine)

Yes, max function should be fine.

Also, should we fail if the same bucket is attached multiple time to a method ?

Yes.

@rmanibus
Copy link
Contributor

rmanibus commented May 6, 2024

@mschorsch sounds reasonable to me. Do you want to contribute that?

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

No branches or pull requests

2 participants