Hi!
I noticed that in my setup the traffic rate limiter does not work when it is set up at the service.handler level, but service level limiter seems to work fine.
I tried to analyze the issue and my current understanding is that the limiter is skipped because it has ScopeClient:
|
case limiter.ScopeClient: |
|
return nil |
|
case limiter.ScopeClient: |
|
return nil |
when I change initialization of the handler to use ScopeService here:
|
cache_limiter.ScopeOption(limiter.ScopeClient), |
|
limiter.ScopeOption(limiter.ScopeClient), |
it seems to fix the issue and limiter works correctly.
I'm not entirely sure that my analysis is correct and the solution would not break something else.
Can someone clarify what is the intended way to use this limiter, why does it have ScopeClient and why is it skipped in In and Out handlers?
I think I will continue to use ScopeService for my setup as it solves the issue and limits traffic correctly for now.
Hi!
I noticed that in my setup the traffic rate limiter does not work when it is set up at the service.handler level, but service level limiter seems to work fine.
I tried to analyze the issue and my current understanding is that the limiter is skipped because it has ScopeClient:
x/limiter/traffic/traffic.go
Lines 140 to 141 in 77eda4c
x/limiter/traffic/traffic.go
Lines 219 to 220 in 77eda4c
when I change initialization of the handler to use ScopeService here:
x/handler/http/handler.go
Line 98 in 77eda4c
x/handler/http/handler.go
Line 322 in 77eda4c
it seems to fix the issue and limiter works correctly.
I'm not entirely sure that my analysis is correct and the solution would not break something else.
Can someone clarify what is the intended way to use this limiter, why does it have ScopeClient and why is it skipped in In and Out handlers?
I think I will continue to use ScopeService for my setup as it solves the issue and limits traffic correctly for now.