mirror of
https://github.com/mailscope/kumomta.git
synced 2026-10-30 01:56:52 +00:00
logging: load meta before retrieving the recipient_list
We had a sponsor report an issue where we'd log an error during
processing a log hook. It transpired that the recipient list we were
attempting to log was `["metadata is not loaded"]`, which doesn't parse
as a valid EnvelopeAddress (see prior commit:
52e2f95e9f)
This commit fixes up the recipient_list logic in the logging function to
avoid taking the error message as the recipient list, and moves the
metadata loading to happen just before we try to read the recipient
list.
This should work around the issue, but a consequence is that we might
be holding on to the metadata for that message in RAM for longer than
we should; will need to do some thinking about managing the resident
status in this situation better.
This commit is contained in:
@@ -54,17 +54,18 @@ pub async fn log_disposition(args: LogDisposition<'_>) {
|
||||
return;
|
||||
}
|
||||
|
||||
msg.load_meta_if_needed().await.ok();
|
||||
|
||||
let recipient_list = match recipient_list {
|
||||
Some(list) => list,
|
||||
None => msg
|
||||
.recipient_list_string()
|
||||
.unwrap_or_else(|err| vec![format!("{err:#}")]),
|
||||
None => msg.recipient_list_string().unwrap_or_else(|err| {
|
||||
tracing::error!("log_disposition: recipient_list_string: {err:#}");
|
||||
vec![]
|
||||
}),
|
||||
};
|
||||
|
||||
let mut feedback_report = None;
|
||||
|
||||
msg.load_meta_if_needed().await.ok();
|
||||
|
||||
let reception_protocol = msg.get_meta_string("reception_protocol").unwrap_or(None);
|
||||
|
||||
if kind == RecordType::Reception {
|
||||
|
||||
Reference in New Issue
Block a user