Skip to content

[Feature request]: Improve the OnRejected property of RateLimiterStrategyOptions #2919

@PopeyeZhong

Description

@PopeyeZhong

Is your feature request related to a specific problem? Or an existing feature?

When using RateLimiting, rejections consistently raised RateLimiterRejectedException, which may cause performance issues. Therefore, I wish to modify the OnRejected property type in the RateLimiterStrategyOptions class to:
Func<OnRateLimiterRejectedArguments, ValueTask<bool>> This would allow it to return a bool value indicating whether handling is complete.
If true (handled) is returned, the ExecuteCore method of the RateLimiterResilienceStrategy class does not need to set the Outcome exception at the end.


🇨🇳 Chinese:
我在使用 RateLimiter 时,当被拒绝发生总是会激发一个 RateLimiterRejectedException,这可能会造成一些性能问题。

Describe the solution you'd like

I wish to modify the OnRejected property type in the RateLimiterStrategyOptions class to:
Func<OnRateLimiterRejectedArguments, ValueTask<bool>> This would allow it to return a bool value indicating whether handling is complete.
If true (handled) is returned, the ExecuteCore method of the RateLimiterResilienceStrategy class does not need to set the Outcome exception at the end.


🇨🇳 Chinese:
我希望将 RateLimiterStrategyOptions 类中的 OnRejected 属性类型改成:
Func<OnRateLimiterRejectedArguments, ValueTask<bool>> 让它返回一个 bool 值来表示是否已经处理完成,如果返回 true,则 RateLimiterResilienceStrategy 类的 ExecuteCore 方法在最后无需设置 Outcome 的异常。

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions