diff --git a/mw_api_rate_limit.go b/mw_api_rate_limit.go index d12c1f4fd04..ca9d3596c4b 100644 --- a/mw_api_rate_limit.go +++ b/mw_api_rate_limit.go @@ -67,7 +67,7 @@ func (k *RateLimitForAPI) ProcessRequest(w http.ResponseWriter, r *http.Request, storeRef, true, false, - k.Spec.GlobalConfig, + &k.Spec.GlobalConfig, ) if reason == sessionFailRateLimit { diff --git a/mw_organisation_activity.go b/mw_organisation_activity.go index 4eb80fffd60..276e8a1020b 100644 --- a/mw_organisation_activity.go +++ b/mw_organisation_activity.go @@ -67,7 +67,7 @@ func (k *OrganizationMonitor) ProcessRequestLive(r *http.Request) (error, int) { k.Spec.OrgSessionManager.Store(), session.Per > 0 && session.Rate > 0, true, - k.Spec.GlobalConfig, + &k.Spec.GlobalConfig, ) k.Spec.OrgSessionManager.UpdateSession(k.Spec.OrgID, &session, session.Lifetime(k.Spec.SessionLifetime), false) @@ -191,7 +191,7 @@ func (k *OrganizationMonitor) AllowAccessNext( k.Spec.OrgSessionManager.Store(), session.Per > 0 && session.Rate > 0, true, - k.Spec.GlobalConfig, + &k.Spec.GlobalConfig, ) k.Spec.OrgSessionManager.UpdateSession(k.Spec.OrgID, &session, session.Lifetime(k.Spec.SessionLifetime), false) diff --git a/mw_rate_limiting.go b/mw_rate_limiting.go index f50bdf587b7..4d14a7eff73 100644 --- a/mw_rate_limiting.go +++ b/mw_rate_limiting.go @@ -71,7 +71,7 @@ func (k *RateLimitAndQuotaCheck) ProcessRequest(w http.ResponseWriter, r *http.R storeRef, !k.Spec.DisableRateLimit, !k.Spec.DisableQuota, - k.Spec.GlobalConfig, + &k.Spec.GlobalConfig, ) // If either are disabled, save the write roundtrip diff --git a/session_manager.go b/session_manager.go index 12d69bddb27..763cbc35a20 100644 --- a/session_manager.go +++ b/session_manager.go @@ -33,7 +33,7 @@ type SessionLimiter struct { bucketStore leakybucket.Storage } -func (l *SessionLimiter) doRollingWindowWrite(key, rateLimiterKey, rateLimiterSentinelKey string, currentSession *user.SessionState, store storage.Handler, globalConf config.Config) bool { +func (l *SessionLimiter) doRollingWindowWrite(key, rateLimiterKey, rateLimiterSentinelKey string, currentSession *user.SessionState, store storage.Handler, globalConf *config.Config) bool { log.Debug("[RATELIMIT] Inbound raw key is: ", key) log.Debug("[RATELIMIT] Rate limiter key is: ", rateLimiterKey) pipeline := globalConf.EnableNonTransactionalRateLimiter @@ -73,7 +73,7 @@ const ( // sessionFailReason if session limits have been exceeded. // Key values to manage rate are Rate and Per, e.g. Rate of 10 messages // Per 10 seconds -func (l *SessionLimiter) ForwardMessage(currentSession *user.SessionState, key string, store storage.Handler, enableRL, enableQ bool, globalConf config.Config) sessionFailReason { +func (l *SessionLimiter) ForwardMessage(currentSession *user.SessionState, key string, store storage.Handler, enableRL, enableQ bool, globalConf *config.Config) sessionFailReason { rateLimiterKey := RateLimitKeyPrefix + storage.HashKey(key) rateLimiterSentinelKey := RateLimitKeyPrefix + storage.HashKey(key) + ".BLOCKED"