Skip to content

Commit

Permalink
issue 289: ratelimiting plugin: cope with non-atomic increments of ca…
Browse files Browse the repository at this point in the history
…ssandra counters
  • Loading branch information
Sorin Manolache committed Jun 4, 2015
1 parent 4732eac commit 96a802f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kong/plugins/ratelimiting/access.lua
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ function _M.execute(conf)
ngx.header[constants.HEADERS.RATELIMIT_LIMIT] = conf.limit
ngx.header[constants.HEADERS.RATELIMIT_REMAINING] = math.max(0, remaining - 1) -- -1 for this current request

if remaining == 0 then
if remaining <= 0 then
ngx.ctx.stop_phases = true -- interrupt other phases of this request
return responses.send(429, "API rate limit exceeded")
end

0 comments on commit 96a802f

Please sign in to comment.