mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Fixed persistent state with outdated data + updated Bincode docs
This commit is contained in:
parent
435257244c
commit
365174adc9
3 changed files with 10 additions and 2 deletions
|
@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Now Vec<MessageId> in requests serializes into [number] instead of [ {message_id: number} ], `forward_messages`, `copy_messages` and `delete_messages` now work properly
|
- Now Vec<MessageId> in requests serializes into [number] instead of [ {message_id: number} ], `forward_messages`, `copy_messages` and `delete_messages` now work properly
|
||||||
- Now `InlineQueryResultsButton` serializes properly ([issue 1181](https://github.com/teloxide/teloxide/issues/1181))
|
- Now `InlineQueryResultsButton` serializes properly ([issue 1181](https://github.com/teloxide/teloxide/issues/1181))
|
||||||
- Now `ThreadId` is able to serialize in multipart requests ([PR 1179](https://github.com/teloxide/teloxide/pull/1179))
|
- Now `ThreadId` is able to serialize in multipart requests ([PR 1179](https://github.com/teloxide/teloxide/pull/1179))
|
||||||
|
- Now persistent state storage won't break if the data is outdated ([issue 1156](https://github.com/teloxide/teloxide/issues/1156))
|
||||||
|
|
||||||
## 0.13.0 - 2024-08-16
|
## 0.13.0 - 2024-08-16
|
||||||
|
|
||||||
|
|
|
@ -232,8 +232,9 @@ where
|
||||||
match dialogue.get_or_default().await {
|
match dialogue.get_or_default().await {
|
||||||
Ok(dialogue) => Some(dialogue),
|
Ok(dialogue) => Some(dialogue),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!("dialogue.get_or_default() failed: {:?}", err);
|
log::error!("dialogue.get_or_default() failed: {:?}, falling back to default", err);
|
||||||
None
|
dialogue.update(D::default()).await.ok()?;
|
||||||
|
dialogue.get_or_default().await.ok()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -52,7 +52,13 @@ where
|
||||||
|
|
||||||
/// The [Bincode] serializer for memory storages.
|
/// The [Bincode] serializer for memory storages.
|
||||||
///
|
///
|
||||||
|
/// Can't serialize if the length is unknown, [see this issue](https://github.com/bincode-org/bincode/issues/167).
|
||||||
|
/// Use [`Cbor`] or [`Json`] if you are storing structs like [`Message`].
|
||||||
|
///
|
||||||
/// [Bincode]: https://github.com/servo/bincode
|
/// [Bincode]: https://github.com/servo/bincode
|
||||||
|
/// [`Cbor`]: crate::dispatching::dialogue::serializer::Cbor
|
||||||
|
/// [`Json`]: crate::dispatching::dialogue::serializer::Json
|
||||||
|
/// [`Message`]: crate::types::Message
|
||||||
#[cfg(feature = "bincode-serializer")]
|
#[cfg(feature = "bincode-serializer")]
|
||||||
pub struct Bincode;
|
pub struct Bincode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue