mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-11 19:56:37 +08:00
fix(limiter): fix traffic limiter ScopeClient behavior to allow per-user limits
This commit is contained in:
@@ -136,6 +136,9 @@ func (l *trafficLimiter) In(ctx context.Context, key string, opts ...limiter.Opt
|
|||||||
return nil
|
return nil
|
||||||
|
|
||||||
case limiter.ScopeClient:
|
case limiter.ScopeClient:
|
||||||
|
if lim, ok := l.inLimits.Get(key); ok && lim != nil {
|
||||||
|
return lim.(traffic.Limiter)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
case limiter.ScopeConn:
|
case limiter.ScopeConn:
|
||||||
@@ -215,6 +218,9 @@ func (l *trafficLimiter) Out(ctx context.Context, key string, opts ...limiter.Op
|
|||||||
return nil
|
return nil
|
||||||
|
|
||||||
case limiter.ScopeClient:
|
case limiter.ScopeClient:
|
||||||
|
if lim, ok := l.outLimits.Get(key); ok && lim != nil {
|
||||||
|
return lim.(traffic.Limiter)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
case limiter.ScopeConn:
|
case limiter.ScopeConn:
|
||||||
|
|||||||
Reference in New Issue
Block a user