From: Vsevolod Stakhov Date: Thu, 17 Dec 2015 09:08:02 +0000 (+0000) Subject: Do not sum fuzzy stored count X-Git-Tag: 1.1.0~264 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c33b396d17f653d32bea9d6a0d8874e9f894034b;p=thirdparty%2Frspamd.git Do not sum fuzzy stored count --- diff --git a/src/rspamadm/fuzzy_stat.lua b/src/rspamadm/fuzzy_stat.lua index 96049540a0..3b56f9c1b3 100644 --- a/src/rspamadm/fuzzy_stat.lua +++ b/src/rspamadm/fuzzy_stat.lua @@ -81,7 +81,7 @@ local function sort_ips(tbl, opts) return res end -local function add_result(dst, src) +local function add_result(dst, src, k) if type(src) == 'table' then if type(dst) == 'number' then -- Convert dst to table @@ -91,7 +91,7 @@ local function add_result(dst, src) end for i,v in ipairs(src) do - if dst[i] then + if dst[i] and k ~= 'fuzzy_stored' then dst[i] = dst[i] + v else dst[i] = v @@ -99,9 +99,13 @@ local function add_result(dst, src) end else if type(dst) == 'table' then - dst[1] = dst[1] + src + if k ~= 'fuzzy_stored' then + dst[1] = dst[1] + src + else + dst[1] = src + end else - if dst then + if dst and k ~= 'fuzzy_stored' then dst = dst + src else dst = src @@ -163,7 +167,7 @@ return function(args, res) -- General stats for k,v in pairs(pr['data']) do if k ~= 'keys' then - res_db[k] = add_result(res_db[k], v) + res_db[k] = add_result(res_db[k], v, k) end end