mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-05 18:18:56 +00:00
Allow multiple should_enqueue_log_record hooks to be registered, and take advantage of that inside the shaping helper. `shaper.should_enqueue_log_record` no longer needs to be explicitly plumbed from the config, but we allow calling it still for compatibility reasons. We will remove that compatibility after the next stable release.
24 lines
554 B
Lua
24 lines
554 B
Lua
local tsa = require 'tsa'
|
|
local kumo = require 'kumo'
|
|
|
|
kumo.on('tsa_init', function()
|
|
tsa.start_http_listener {
|
|
listen = '0.0.0.0:8008',
|
|
trusted_hosts = { '127.0.0.1', '::1' },
|
|
}
|
|
end)
|
|
|
|
local cached_load_shaping_data = kumo.memoize(kumo.shaping.load, {
|
|
name = 'tsa_load_shaping_data',
|
|
ttl = '5 minutes',
|
|
capacity = 4,
|
|
})
|
|
|
|
kumo.on('tsa_load_shaping_data', function()
|
|
local shaping = cached_load_shaping_data {
|
|
'/opt/kumomta/share/policy-extras/shaping.toml',
|
|
-- "assets/policy-extras/shaping.toml",
|
|
}
|
|
return shaping
|
|
end)
|