mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Trace previous state on update
This commit is contained in:
parent
5830ba2b32
commit
f86217b0f9
1 changed files with 10 additions and 5 deletions
|
@ -1,9 +1,9 @@
|
|||
use std::{fmt::Debug, sync::Arc};
|
||||
use std::{fmt::Debug, marker::{Send, Sync}, sync::Arc};
|
||||
|
||||
use futures::future::BoxFuture;
|
||||
use log::trace;
|
||||
|
||||
use super::Storage;
|
||||
use crate::dispatching::dialogue::Storage;
|
||||
|
||||
/// Storage wrapper for logging purposes
|
||||
///
|
||||
|
@ -26,7 +26,7 @@ impl<S> TraceStorage<S> {
|
|||
impl<S, D> Storage<D> for TraceStorage<S>
|
||||
where
|
||||
D: Debug,
|
||||
S: Storage<D>,
|
||||
S: Storage<D> + Send + Sync + 'static,
|
||||
{
|
||||
type Error = <S as Storage<D>>::Error;
|
||||
|
||||
|
@ -49,7 +49,12 @@ where
|
|||
where
|
||||
D: Send + 'static,
|
||||
{
|
||||
trace!("Updating dialogue with {}: {:#?}", chat_id, dialogue);
|
||||
<S as Storage<D>>::update_dialogue(self.inner.clone(), chat_id, dialogue)
|
||||
Box::pin(async move {
|
||||
trace!("Updating dialogue with {}: {:#?}", chat_id, dialogue);
|
||||
let from =
|
||||
<S as Storage<D>>::update_dialogue(self.inner.clone(), chat_id, dialogue).await?;
|
||||
trace!("Updated dialogue with {}, previous state: {:#?}", chat_id, from);
|
||||
Ok(from)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue