]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Fix other places of 5.4 rounding issues
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 7 Dec 2025 15:00:05 +0000 (15:00 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 7 Dec 2025 15:00:05 +0000 (15:00 +0000)
lualib/llm_context.lua
lualib/lua_stat.lua
src/plugins/lua/neural.lua
src/plugins/lua/url_redirector.lua

index 7973e9e1d20139a1b2749ae8fcd91d6c77865e4f..276a3d8340bd996ca8741aec1e6470af2404dafe 100644 (file)
@@ -518,7 +518,7 @@ function M.update_after_classification(task, redis_params, opts, result, sel_par
       end
     end
     local ok = lua_redis.redis_make_request(task, redis_params, ident.key, true, on_set, 'SETEX',
-      { ident.key, tostring(ttl), payload })
+      { ident.key, tostring(math.floor(ttl)), payload })
     if not ok then
       rspamd_logger.errx(task, 'llm_context: set request was not scheduled')
     end
index a0f3303ad6911958a0ad2bc9419c48ee4b2dcc9e..c8ecb17278fb93d8773cbf16009d2da0b83ab556 100644 (file)
@@ -249,7 +249,7 @@ end
         conn:add_cmd('HINCRBYFLOAT', { rkey, hash_key, tostring(tok[2]) })
 
         if expire and expire ~= 0 then
-          conn:add_cmd('EXPIRE', { rkey, tostring(expire) })
+          conn:add_cmd('EXPIRE', { rkey, tostring(math.floor(expire)) })
         end
       end
 
index 4d61f9771f45e12c903786e983861811bdd1a69d..8d9859f8a9a0ac0e882221b7bd8d3dc4c7f20eef 100644 (file)
@@ -507,7 +507,7 @@ local function do_train_ann(worker, ev_base, rule, set, ann_key)
     {
       ann_key,
       tostring(os.time()),
-      tostring(math.max(10.0, rule.watch_interval * 2)),
+      tostring(math.floor(math.max(10.0, rule.watch_interval * 2))),
       rspamd_util.get_hostname()
     })
 end
index 1e5bc137c08d718207bc51deb0090c731eb81862..f60d3bd08be6223a0b53ff4e2ddf49b3845e1567 100644 (file)
@@ -345,7 +345,7 @@ local function resolve_cached(task, orig_url, url, key, ntries)
           true, -- is write
           redis_reserve_cb, --callback
           'SET', -- command
-          { key, 'processing', 'EX', tostring(settings.timeout * 2), 'NX' } -- arguments
+          { key, 'processing', 'EX', tostring(math.floor(settings.timeout * 2)), 'NX' } -- arguments
       )
       if not ret then
         rspamd_logger.errx(task, 'Couldn\'t schedule SET')