From 08fb5403de2ac18b99924f522859de875c9cb87f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 9 Sep 2022 21:06:00 +0100 Subject: [PATCH] [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 -- 2.39.5