From: Vsevolod Stakhov Date: Fri, 9 Sep 2022 20:06:00 +0000 (+0100) Subject: [Minor] Add timeout augmentation for external services/av plugins X-Git-Tag: 3.3~40 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=08fb5403de2ac18b99924f522859de875c9cb87f;p=rspamd.git [Minor] Add timeout augmentation for external services/av plugins --- 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