Browse Source

[Minor] Register more timeouts

tags/3.3
Vsevolod Stakhov 1 year ago
parent
commit
79796c6f5f
No account linked to committer's email address

+ 2
- 0
src/plugins/lua/bimi.lua View File

@@ -365,6 +365,8 @@ if redis_params then
name = 'BIMI_CHECK',
type = 'normal',
callback = bimi_callback,
augmentations = {string.format("timeout=%f", settings.helper_timeout or
redis_params.timeout or 0.0)}
})
rspamd_config:register_symbol{
name = 'BIMI_VALID',

+ 1
- 0
src/plugins/lua/clustering.lua View File

@@ -301,6 +301,7 @@ if opts['rules'] then
type = 'idempotent',
flags = 'empty,explicit_disable,ignore_passthrough',
callback = callback_gen(clusterting_idempotent_cb, rule),
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)}
}
end
else

+ 1
- 0
src/plugins/lua/elastic.lua View File

@@ -519,6 +519,7 @@ if redis_params and opts then
callback = elastic_collect,
priority = 10,
flags = 'empty,explicit_disable,ignore_passthrough',
augmentations = {string.format("timeout=%f", settings.timeout)},
})

rspamd_config:add_on_load(function(cfg, ev_base,worker)

+ 2
- 1
src/plugins/lua/history_redis.lua View File

@@ -290,7 +290,8 @@ if opts then
type = 'idempotent',
callback = history_save,
flags = 'empty,explicit_disable,ignore_passthrough',
priority = 150
priority = 150,
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)}
})
lua_redis.register_prefix(settings.key_prefix .. hostname, N,
"Redis history", {

+ 5
- 0
src/plugins/lua/metadata_exporter.lua View File

@@ -484,6 +484,7 @@ if type(settings.rules) ~= 'table' then
r.defer = settings.defer
r.selector = settings.pusher_select.redis_pubsub
r.formatter = settings.pusher_format.redis_pubsub
r.timeout = redis_params.timeout
settings.rules[r.backend:upper()] = r
end
end
@@ -499,6 +500,7 @@ if type(settings.rules) ~= 'table' then
r.defer = settings.defer
r.selector = settings.pusher_select.http
r.formatter = settings.pusher_format.http
r.timeout = settings.timeout or 0.0
settings.rules[r.backend:upper()] = r
end
end
@@ -516,6 +518,7 @@ if type(settings.rules) ~= 'table' then
r.smtp_port = settings.smtp_port
r.email_template = settings.email_template
r.defer = settings.defer
r.timeout = settings.timeout or 0.0
r.selector = settings.pusher_select.send_mail
r.formatter = settings.pusher_format.send_mail
settings.rules[r.backend:upper()] = r
@@ -593,6 +596,7 @@ backend_check.redis_pubsub = function(k, rule)
settings.rules[k] = nil
else
backend_check.default(k, rule)
rule.timeout = redis_params.timeout
end
end
setmetatable(backend_check, {
@@ -650,5 +654,6 @@ for k, r in pairs(settings.rules) do
callback = gen_exporter(r),
priority = 10,
flags = 'empty,explicit_disable,ignore_passthrough',
augmentations = {string.format("timeout=%f", r.timeout or 0.0)}
})
end

+ 1
- 0
src/plugins/lua/mx_check.lua View File

@@ -315,6 +315,7 @@ if opts then
type = 'normal',
callback = mx_check,
flags = 'empty',
augmentations = {string.format("timeout=%f", settings.timeout + rspamd_config:get_dns_timeout() or 0.0)},
})
rspamd_config:register_symbol({
name = settings.symbol_no_mx,

+ 3
- 1
src/plugins/lua/p0f.lua View File

@@ -89,7 +89,9 @@ if rule then
callback = check_p0f,
priority = 8,
flags = 'empty,nostat',
group = N
group = N,
augmentations = {string.format("timeout=%f", rule.timeout or 0.0)},

})

if rule.symbol then

+ 2
- 0
src/plugins/lua/ratelimit.lua View File

@@ -871,6 +871,7 @@ if opts then
priority = 7,
callback = ratelimit_cb,
flags = 'empty,nostat',
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)},
}

local id = rspamd_config:register_symbol(s)
@@ -914,6 +915,7 @@ if opts then
name = 'RATELIMIT_UPDATE',
flags = 'explicit_disable,ignore_passthrough',
callback = ratelimit_update_cb,
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)},
}
end
end

+ 4
- 2
src/plugins/lua/rbl.lua View File

@@ -1283,14 +1283,16 @@ rspamd_config:register_symbol{
type = 'callback',
callback = rbl_callback_white,
name = 'RBL_CALLBACK_WHITE',
flags = 'nice,empty,no_squeeze'
flags = 'nice,empty,no_squeeze',
augmentations = {string.format("timeout=%f", rspamd_config:get_dns_timeout() or 0.0)},
}

rspamd_config:register_symbol{
type = 'callback',
callback = rbl_callback_fin,
name = 'RBL_CALLBACK',
flags = 'empty,no_squeeze'
flags = 'empty,no_squeeze',
augmentations = {string.format("timeout=%f", rspamd_config:get_dns_timeout() or 0.0)},
}

for _, w in ipairs(white_symbols) do

+ 3
- 0
src/plugins/lua/reputation.lua View File

@@ -1302,6 +1302,7 @@ local function parse_rule(name, tbl)
name = rule.symbol,
type = rule_type,
callback = callback_gen(reputation_filter_cb, rule),
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)},
}

if rule.selector.config.split_symbols then
@@ -1330,6 +1331,7 @@ local function parse_rule(name, tbl)
type = 'postfilter',
flags = 'nostat,explicit_disable,ignore_passthrough',
callback = callback_gen(reputation_postfilter_cb, rule),
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)},
}
end

@@ -1340,6 +1342,7 @@ local function parse_rule(name, tbl)
type = 'idempotent',
flags = 'explicit_disable,ignore_passthrough',
callback = callback_gen(reputation_idempotent_cb, rule),
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)},
}
end


+ 1
- 0
src/plugins/lua/settings.lua View File

@@ -1230,6 +1230,7 @@ if redis_section then
callback = gen_redis_callback(h, id),
priority = 10,
flags = 'empty,nostat',
augmentations = {string.format("timeout=%f", redis_params.timeout or 0.0)},
})
end, redis_key_handlers)
end

+ 5
- 1
src/plugins/lua/spf.lua View File

@@ -209,7 +209,11 @@ local sym_id = rspamd_config:register_symbol{
flags = 'fine,empty',
groups = {'policies','spf'},
score = 0.0,
callback = spf_check_callback
callback = spf_check_callback,
-- We can merely estimate timeout here, as it is possible to construct an SPF record that would cause
-- many DNS requests. But we won't like to set the maximum value for that all the time, as
-- the majority of requests will typically have 1-4 subrequests
augmentations = {string.format("timeout=%f", rspamd_config:get_dns_timeout() * 4 or 0.0)},
}

if local_config.whitelist then

+ 2
- 0
src/plugins/lua/url_redirector.lua View File

@@ -357,6 +357,8 @@ if opts then
name = 'URL_REDIRECTOR_CHECK',
type = 'callback,prefilter',
callback = url_redirector_handler,
-- In fact, the real timeout is nested_limit * timeout...
augmentations = {string.format("timeout=%f", settings.timeout)}
}

if settings.redirector_symbol then

Loading…
Cancel
Save