Skip to content

Commit

Permalink
Add ManagementNode config option to disable DRL
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan authored and lonelycode committed Mar 13, 2017
1 parent 931ebcb commit 07d1a62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ type Config struct {
EnableNonTransactionalRateLimiter bool `json:"enable_non_transactional_rate_limiter"`
EnableSentinelRateLImiter bool `json:"enable_sentinel_rate_limiter"`
EnableRedisRollingLimiter bool `json:"enable_redis_rolling_limiter"`
ManagementNode bool `json:"management_node"`
Monitor MonitorConfig
OauthRefreshExpire int64 `json:"oauth_refresh_token_expire"`
OauthTokenExpire int32 `json:"oauth_token_expire"`
Expand Down
16 changes: 10 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1241,13 +1241,17 @@ func startHeartBeat() {
}

func startDRL() {
if !config.EnableSentinelRateLImiter && !config.EnableRedisRollingLimiter {
log.WithFields(logrus.Fields{
"prefix": "main",
}).Info("Initialising distributed rate limiter")
setupDRL()
startRateLimitNotifications()
switch {
case config.ManagementNode,
config.EnableSentinelRateLImiter,
config.EnableRedisRollingLimiter:
return
}
log.WithFields(logrus.Fields{
"prefix": "main",
}).Info("Initialising distributed rate limiter")
setupDRL()
startRateLimitNotifications()
}

func listen(l, controlListener net.Listener, err error) {
Expand Down

0 comments on commit 07d1a62

Please sign in to comment.