From 3b10b1240fbcde800d329ff937a5e1a27e887400 Mon Sep 17 00:00:00 2001 From: Sorin Manolache Date: Thu, 4 Jun 2015 16:24:08 +0200 Subject: [PATCH] issue 289: ratelimiting plugin: cope with non-atomic increments of cassandra counters Former-commit-id: 2ec221cc96eeedee96ede35d011bba98bdd96d83 --- kong/plugins/ratelimiting/access.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kong/plugins/ratelimiting/access.lua b/kong/plugins/ratelimiting/access.lua index ead62889eb3e..87eab3d6d4eb 100644 --- a/kong/plugins/ratelimiting/access.lua +++ b/kong/plugins/ratelimiting/access.lua @@ -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