From: Vsevolod Stakhov Date: Thu, 26 Feb 2015 17:22:22 +0000 (+0000) Subject: Fix closure parameters. X-Git-Tag: 0.9.0~606 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=40859574da2836f957efc983d5818f52c3b46dad;p=rspamd.git Fix closure parameters. --- diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua index c816e12ca..99f5d83b8 100644 --- a/src/plugins/lua/ratelimit.lua +++ b/src/plugins/lua/ratelimit.lua @@ -141,6 +141,10 @@ end --- Set specific limit inside redis local function set_limits(task, args) + local key = _.foldl(function(acc, k) return acc .. k[2] end, '', args) + local upstream = upstreams:get_upstream_by_hash(key) + local addr = upstream:get_addr() + local function rate_set_key_cb(task, err, data) if err then rspamd_logger.info('got error while setting limit: ' .. err) @@ -149,9 +153,6 @@ local function set_limits(task, args) upstream:ok() end end - local key = _.foldl(function(acc, k) return acc .. k[2] end, '', args) - local upstream = upstreams:get_upstream_by_hash(key) - local addr = upstream:get_addr() local function rate_set_cb(task, err, data) if data then