]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Ignore skipped tasks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 31 Oct 2018 21:35:27 +0000 (21:35 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 31 Oct 2018 21:35:27 +0000 (21:35 +0000)
TODO: write a generic framework for that stuff

src/plugins/lua/clickhouse.lua
src/plugins/lua/clustering.lua
src/plugins/lua/elastic.lua
src/plugins/lua/metadata_exporter.lua
src/plugins/lua/neural.lua
src/plugins/lua/ratelimit.lua

index d95325b24c3032660339f9db8c449a8267c8c1b8..556de40ef28b8e5d679636444f18de3799a5f410 100644 (file)
@@ -285,6 +285,7 @@ local function clickhouse_send_data(task)
 end
 
 local function clickhouse_collect(task)
+  if task:has_flag('skip') then return end
   if not settings.allow_local and rspamd_lua_utils.is_rspamc_or_controller(task) then return end
 
   for _,sym in ipairs(settings.stop_symbols) do
index 2711c0658b5dba04c0d6ef0c1fbab2d0f68eb937..a5d72fc64294aca7095d7c867372e67605487caa 100644 (file)
@@ -186,6 +186,9 @@ local function clusterting_filter_cb(task, rule)
 end
 
 local function clusterting_idempotent_cb(task, rule)
+  if task:has_flag('skip') then return end
+  if not rule.allow_local and lua_util.is_rspamc_or_controller(task) then return end
+
   local verdict = lua_util.get_task_verdict(task)
   local score
 
index 87e01063a2810c9307c2272e8235d190bf6c2c05..c7f9f392e8e9e0c166b3b7bb3f18db29a3db953e 100644 (file)
@@ -208,7 +208,9 @@ end
 
 local function elastic_collect(task)
   if not enabled then return end
+  if task:has_flag('skip') then return end
   if not settings.allow_local and lua_util.is_rspamc_or_controller(task) then return end
+
   local row = {['rspamd_meta'] = get_general_metadata(task),
     ['@timestamp'] = tostring(util.get_time() * 1000)}
   table.insert(rows, row)
index 57fe0f105e38ccafbdb1223f463ae19ff6415476..951142368f9f01a9dcb608da7d1c145dc72e3cc0 100644 (file)
@@ -688,6 +688,7 @@ end
 
 local function gen_exporter(rule)
   return function (task)
+    if task:has_flag('skip') then return end
     local selector = rule.selector or 'default'
     local selected = selectors[selector](task)
     if selected then
index 71ae3afb69b92e6c61579913a1502a726224b40e..43d7bb12760eae479f415d9d356bd1dbc3ecafcc 100644 (file)
@@ -904,6 +904,8 @@ local function check_anns(rule, _, ev_base)
 end
 
 local function ann_push_vector(task)
+  if task:has_flag('skip') then return end
+  if not settings.allow_local and lua_util.is_rspamc_or_controller(task) then return end
   local scores = task:get_metric_score()
   for _,rule in pairs(settings.rules) do
     local sid = "0"
index 4759d553f0c65d6d1ee865f7f051ddfbc025852f..5eddfadba4ec2d94f3275b3b2a7f889be8cf27e7 100644 (file)
@@ -622,6 +622,8 @@ local function ratelimit_cb(task)
 end
 
 local function ratelimit_update_cb(task)
+  if task:has_flag('skip') then return end
+  if not settings.allow_local and lua_util.is_rspamc_or_controller(task) then return end
   local prefixes = task:cache_get('ratelimit_prefixes')
 
   if prefixes then