From 415d4fc19cdadbbd147c046ddc84026376bc8e9a Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 10 Apr 2024 14:13:40 -0700 Subject: [PATCH] tsa: make the default queue config for tsa-daemon more aggressive while troubleshooting a situation where the http://127.0.0.1:8008.tsa.kumomta queue is backing up, I noticed that we're using the default queue configuration for this queue. Let's make it more inline with the defaults for webhooks; give it a 1 minute base retry with a 20 minute max. These parameters are configurable; you can pass in `tsa_queue_config` to the setup_with_automation call to specify your preferred values for the scheduled queue config. --- assets/policy-extras/shaping.lua | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/assets/policy-extras/shaping.lua b/assets/policy-extras/shaping.lua index 7d078169..ab6f6f0e 100644 --- a/assets/policy-extras/shaping.lua +++ b/assets/policy-extras/shaping.lua @@ -107,16 +107,20 @@ local function construct_publisher(publish, domain) return connection end -local function get_queue_cfg(publish, domain, tenant, campaign) +local function get_queue_cfg(options, publish, domain, tenant, campaign) for _, data in pairs(publish) do if data.hook_name == domain then - return kumo.make_queue_config { - protocol = { - custom_lua = { - constructor = data.constructor, - }, + local params = { + retry_interval = '1m', + max_retry_interval = '20m', + } + utils.merge_into(options.tsa_queue_config, params) + params.protocol = { + custom_lua = { + constructor = data.constructor, }, } + return kumo.make_queue_config(params) end end end @@ -209,6 +213,13 @@ local shaper = shaping:setup_with_automation { -- the additional files beyond /opt/kumomta/share/policy-extras/shaping.toml in your -- tsa config extra_files = { '/opt/kumomta/etc/policy/shaping.toml' }, + + -- optional; override the queue config for talking to the TSA daemon. + -- These are the default values. + tsa_queue_config = { + retry_interval = '1m', + max_retry_interval = '20m', + }, } kumo.on('init', function() @@ -333,7 +344,7 @@ function mod:setup_with_automation(options) kumo.on( 'get_queue_config', function(domain, tenant, campaign, routing_domain) - return get_queue_cfg(publish, domain, tenant, campaign) + return get_queue_cfg(options, publish, domain, tenant, campaign) end )