Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Implement ForceDrainOverlimit config option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Baliedge committed Jan 4, 2024
1 parent ed7f198 commit 0ce98a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions gubernator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0ce98a7

Please sign in to comment.