commit 0ffc51b: [Minor] Fix table unpacking
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Mar 16 11:49:12 UTC 2020
Author: Vsevolod Stakhov
Date: 2020-03-16 11:43:54 +0000
URL: https://github.com/rspamd/rspamd/commit/0ffc51bd41126f99f59a7efb13c5ef52c7308192 (HEAD -> master)
[Minor] Fix table unpacking
---
src/plugins/lua/neural.lua | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index affb07307..a508c36b3 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -1051,7 +1051,6 @@ local function maybe_train_existing_ann(worker, ev_base, rule, set, profiles)
local ntrains = tonumber(data) or 0
lens[what] = ntrains
if is_final then
- local unpack = rawget(table, "unpack") or unpack
-- Ensure that we have the following:
-- one class has reached max_trains
-- other class(es) are at least as full as classes_bias
@@ -1059,7 +1058,7 @@ local function maybe_train_existing_ann(worker, ev_base, rule, set, profiles)
-- one class must have 10 or more trains whilst another should have
-- at least (10 * (1 - 0.25)) = 8 trains
- local max_len = math.max(unpack(lens))
+ local max_len = math.max(lua_util.unpack(lua_util.values(lens)))
local len_bias_check_pred = function(l)
return l >= rule.train.max_trains * (1.0 - rule.train.classes_bias)
end
More information about the Commits
mailing list