mirror of
https://github.com/mailscope/kumomta.git
synced 2026-10-21 14:02:25 +00:00
If you have a get_queue_config event handler that raises an error, it will propagate back to the injector as a transient error, which is the desired behavior. However, we didn't ensure that the message was removed from the spool in that situation, which could lead to duplicate sends of the same logical message. This commit makes things more robust in the context of this kind of local configuration issue: * QueueManager::insert_or_unwind is now the preferred way to handle insertion of the message into the queue during reception at the point of ingress. It will take care to remove the message from the spool and to adjust the accounting by logging a Bounce record to complement the Reception that it assumes that its caller has just logged for the message. * Both SMTP and HTTP listeners have been updated to use insert_or_unwind. * Spool enumeration has been updated to count failed inserts and to summarize that the failure is serious and that the messages are not going to go anywhere until the configuration issue is addressed and the server is restarted. Note that we cannot recover from this while the server is online because we have to perform a full spool enumeration in order to re-discover those messages. (We could potentially build a thing to remember the complete list of messages, but I'd rather not try to address what is essentially a configuration deployment validation problem with engineering on this end of things.)