]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use more portable rounding function
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 11 Mar 2018 15:12:25 +0000 (15:12 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 11 Mar 2018 15:12:25 +0000 (15:12 +0000)
src/plugins/lua/bayes_expiry.lua

index 7e6938e677cedcc31133c651126bc132ef743ae2..725a163c760f613e823af791abb2d5824f058a20 100644 (file)
@@ -164,12 +164,12 @@ local expiry_script = [[
       local total = ham + spam
       if ham / total > ${significant_factor} or spam / total > ${significant_factor} then
         redis.replicate_commands()
-        redis.call('EXPIRE', key, math.tointeger(KEYS[2]))
+        redis.call('EXPIRE', key, math.floor(KEYS[2]))
         extended = extended + 1
       elseif math.abs(ham - spam) <= total * ${epsilon_common} then
         local ttl = redis.call('TTL', key)
         redis.replicate_commands()
-        redis.call('EXPIRE', key, math.tointeger(tonumber(ttl) / ${common_ttl_divisor}))
+        redis.call('EXPIRE', key, math.floor(tonumber(ttl) / ${common_ttl_divisor}))
         discriminated = discriminated + 1
       end
     end