aboutsummaryrefslogtreecommitdiffstats
path: root/lualib/rspamadm/rescore.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-04 15:32:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-10-04 15:32:27 +0100
commit6c57c656955c6ab3577a1e4a5477379b01471889 (patch)
treedf5493ae00aaab2744d5adc48861d30be1cce687 /lualib/rspamadm/rescore.lua
parent99c862f6176f60b8f2b9939f06298696b9d261af (diff)
downloadrspamd-6c57c656955c6ab3577a1e4a5477379b01471889.tar.gz
rspamd-6c57c656955c6ab3577a1e4a5477379b01471889.zip
[Fix] Do not load torch on each rspamadm invocation
Diffstat (limited to 'lualib/rspamadm/rescore.lua')
-rw-r--r--lualib/rspamadm/rescore.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/lualib/rspamadm/rescore.lua b/lualib/rspamadm/rescore.lua
index cc331c6e8..dfa73f2d5 100644
--- a/lualib/rspamadm/rescore.lua
+++ b/lualib/rspamadm/rescore.lua
@@ -18,8 +18,6 @@ if not rspamd_config:has_torch() then
return
end
-local torch = require "torch"
-local nn = require "nn"
local lua_util = require "lua_util"
local ucl = require "ucl"
local logger = require "rspamd_logger"
@@ -28,6 +26,10 @@ local rspamd_util = require "rspamd_util"
local argparse = require "argparse"
local rescore_utility = require "rescore_utility"
+-- Load these lazily
+local torch
+local nn
+
local opts
local ignore_symbols = {
['DATE_IN_PAST'] =true,
@@ -509,6 +511,8 @@ local function get_threshold()
end
local function handler(args)
+ torch = require "torch"
+ nn = require "nn"
opts = parser:parse(args)
if not opts['log'] then
parser:error('no log specified')