diff --git a/config.go b/config.go index c46e2fa3..dd8e0eaa 100644 --- a/config.go +++ b/config.go @@ -62,8 +62,10 @@ type BehaviorConfig struct { GlobalTimeout time.Duration // The max number of global updates we can batch into a single peer request GlobalBatchLimit int - // ForceGlobal forces global mode on all rate limit checks. + // ForceGlobal forces global behavior on all rate limit checks. ForceGlobal bool + // ForceDrainOverlimit forces drain overlimit behavior on all rate limit checks. + ForceDrainOverlimit bool // Number of concurrent requests that will be made to peers. Defaults to 100 GlobalPeerRequestsConcurrency int diff --git a/gubernator.go b/gubernator.go index 59c26eca..56305a8b 100644 --- a/gubernator.go +++ b/gubernator.go @@ -225,6 +225,9 @@ func (s *V1Instance) GetRateLimits(ctx context.Context, r *GetRateLimitsReq) (*G if s.conf.Behaviors.ForceGlobal { SetBehavior(&req.Behavior, Behavior_GLOBAL, true) } + if s.conf.Behaviors.ForceDrainOverlimit { + SetBehavior(&req.Behavior, Behavior_DRAIN_OVERLIMIT, true) + } peer, err = s.GetPeer(ctx, key) if err != nil {