mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-24 23:57:38 +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 futures::future::BoxFuture;
|
||||||
use log::trace;
|
use log::trace;
|
||||||
|
|
||||||
use super::Storage;
|
use crate::dispatching::dialogue::Storage;
|
||||||
|
|
||||||
/// Storage wrapper for logging purposes
|
/// Storage wrapper for logging purposes
|
||||||
///
|
///
|
||||||
|
@ -26,7 +26,7 @@ impl<S> TraceStorage<S> {
|
||||||
impl<S, D> Storage<D> for TraceStorage<S>
|
impl<S, D> Storage<D> for TraceStorage<S>
|
||||||
where
|
where
|
||||||
D: Debug,
|
D: Debug,
|
||||||
S: Storage<D>,
|
S: Storage<D> + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
type Error = <S as Storage<D>>::Error;
|
type Error = <S as Storage<D>>::Error;
|
||||||
|
|
||||||
|
@ -49,7 +49,12 @@ where
|
||||||
where
|
where
|
||||||
D: Send + 'static,
|
D: Send + 'static,
|
||||||
{
|
{
|
||||||
trace!("Updating dialogue with {}: {:#?}", chat_id, dialogue);
|
Box::pin(async move {
|
||||||
<S as Storage<D>>::update_dialogue(self.inner.clone(), chat_id, dialogue)
|
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…
Add table
Reference in a new issue