commit 08fb540: [Minor] Add timeout augmentation for external services/av plugins

Vsevolod Stakhov vsevolod at rspamd.com
Fri Sep 9 20:07:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-09-09 21:06:00 +0100
URL: https://github.com/rspamd/rspamd/commit/08fb5403de2ac18b99924f522859de875c9cb87f (HEAD -> master)

[Minor] Add timeout augmentation for external services/av plugins

---
 src/plugins/lua/antivirus.lua         | 8 ++++++++
 src/plugins/lua/external_services.lua | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/plugins/lua/antivirus.lua b/src/plugins/lua/antivirus.lua
index c73e4fa2f..dba472c50 100644
--- a/src/plugins/lua/antivirus.lua
+++ b/src/plugins/lua/antivirus.lua
@@ -197,6 +197,14 @@ if opts and type(opts) == 'table' then
           t.type = 'normal'
         end
 
+        t.augmentations = {}
+
+        if type(m.timeout) == 'number' then
+          -- Here, we ignore possible DNS timeout and timeout from multiple retries
+          -- as these situations are not usual nor likely for the antivirus module
+          table.insert(t.augmentations, string.format("timeout=%f", m.timeout))
+        end
+
         local id = rspamd_config:register_symbol(t)
 
         rspamd_config:register_symbol({
diff --git a/src/plugins/lua/external_services.lua b/src/plugins/lua/external_services.lua
index bafcc9eec..96e6b9e94 100644
--- a/src/plugins/lua/external_services.lua
+++ b/src/plugins/lua/external_services.lua
@@ -227,6 +227,14 @@ if opts and type(opts) == 'table' then
           t.type = 'normal'
         end
 
+        t.augmentations = {}
+
+        if type(m.timeout) == 'number' then
+          -- Here, we ignore possible DNS timeout and timeout from multiple retries
+          -- as these situations are not usual nor likely for the external_services module
+          table.insert(t.augmentations, string.format("timeout=%f", m.timeout))
+        end
+
         local id = rspamd_config:register_symbol(t)
 
         if m.symbol_fail then


More information about the Commits mailing list