mirror of
https://github.com/mailscope/kumomta.git
synced 2026-10-29 01:36:14 +00:00
log hooks: add more error context
We may log things like this during shutdown: ``` logging-3 kumod::logging::hooks: Error while calling should_enqueue_log_record: shutting down ``` but it isn't clear which part of the operation is sensitive to the shutdown situation, so adding some context may help focus attention.
This commit is contained in:
@@ -175,11 +175,12 @@ impl LogHookState {
|
||||
|
||||
LOGGING_RUNTIME.spawn("log-hook".to_string(), async move {
|
||||
let result: anyhow::Result<()> = async move {
|
||||
let mut lua_config = load_config().await?;
|
||||
let mut lua_config = load_config().await.context("load_config")?;
|
||||
|
||||
let enqueue: bool = lua_config
|
||||
.async_call_callback(&SHOULD_ENQ_LOG_RECORD_SIG, (msg.clone(), name))
|
||||
.await?;
|
||||
.await
|
||||
.context("async_call_callback")?;
|
||||
lua_config.put();
|
||||
|
||||
// Release permit before we insert, as insertion itself can generate
|
||||
@@ -188,11 +189,13 @@ impl LogHookState {
|
||||
drop(permit);
|
||||
|
||||
if enqueue {
|
||||
let queue_name = msg.get_queue_name().await?;
|
||||
let queue_name = msg.get_queue_name().await.context("get_queue_name")?;
|
||||
if !deferred_spool {
|
||||
msg.save(None).await?;
|
||||
msg.save(None).await.context("save")?;
|
||||
}
|
||||
QueueManager::insert(&queue_name, msg, InsertReason::Received.into()).await?;
|
||||
QueueManager::insert(&queue_name, msg, InsertReason::Received.into())
|
||||
.await
|
||||
.context("insert")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user