shutdown_logging
Since: Dev Builds Only
The functionality described in this section requires a dev build of KumoMTA. You can obtain a dev build by following the instructions in the Installation section.
Called by kumod
as part of shutdown, just prior to shutting down all loggers.
The intended use case is for you to be able to close
any mpsc queues that you
might have defined in your policy, which in turn allows for a more graceful
shutdown:
local kumo = require 'kumo'
kumo.on('init', function()
kumo.spawn_task {
event_name = 'logger',
args = {},
}
end)
kumo.on('logger', function(args)
local q = kumo.mpsc.define 'queue'
while true do
local batch = q:recv_many(100)
if not batch then
print 'logger loop done; shutting down'
return
end
end
end)
kumo.on('shutdown_logging', function()
local q = kumo.mpsc.define 'queue'
q:close()
end)