]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Ratelimit: remove duplicated division on ham scores; fix registration 930/head
authorAndrew Lewis <nerf@judo.za.org>
Tue, 6 Sep 2016 15:03:45 +0000 (17:03 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Tue, 6 Sep 2016 15:03:45 +0000 (17:03 +0200)
src/plugins/lua/ratelimit.lua

index 48052502f887cea1b8d07a0356f7f7321bf76bd1..8acc3edcfb0fd30fddb249347543e52fe5b6ec36 100644 (file)
@@ -103,7 +103,7 @@ local function resize_element(x_score, x_total, element)
     x_ip_score = x_score / ip_score_spam_divisor
     element = element * rspamd_util.tanh(2.718281 * x_ip_score)
   elseif x_score < 0 then
-    x_ip_score = (1 + ((x_score / x_total) * -1)) * ip_score_ham_multiplier
+    x_ip_score = ((1 + (x_score * -1)) * ip_score_ham_multiplier)
     element = element * x_ip_score
   end
   return element
@@ -518,7 +518,7 @@ if opts then
         symbol = ratelimit_symbol
       end
       local id = rspamd_config:register_symbol({
-        name = ratelimit_symbol,
+        name = symbol,
         callback = rate_test,
       })
       if use_ip_score then