Skip to content

Commit

Permalink
If rate is -1 or 0 skip rate limiting (#3027)
Browse files Browse the repository at this point in the history
Redis RL doesn't care -1 and 0 values. So, I decided to skip rate limiting for `-1` and `0` values. This will also improve performance very effectively. It should be merged to master, 2.10 and 2.9 branches.

Fixes https://github.com/TykTechnologies/tyk-analytics/issues/1719

(cherry picked from commit 2bc48ed)
  • Loading branch information
furkansenharputlu authored and Tyk Bot committed Apr 17, 2020
1 parent 581f549 commit f6f9580
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gateway/session_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ func (l *SessionLimiter) ForwardMessage(r *http.Request, currentSession *user.Se
}
}

if enableRL {
// If rate is -1 or 0, it means unlimited and no need for rate limiting.
if enableRL && apiLimit.Rate > 0 {
rateScope := ""
if allowanceScope != "" {
rateScope = allowanceScope + "-"
Expand Down

0 comments on commit f6f9580

Please sign in to comment.