Fixed persistent state with outdated data + updated Bincode docs

This commit is contained in:
LasterAlex 2024-10-20 23:46:41 +03:00
parent 435257244c
commit 365174adc9
No known key found for this signature in database
3 changed files with 10 additions and 2 deletions

View file

@ -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 `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 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

View file

@ -232,8 +232,9 @@ where
match dialogue.get_or_default().await {
Ok(dialogue) => Some(dialogue),
Err(err) => {
log::error!("dialogue.get_or_default() failed: {:?}", err);
None
log::error!("dialogue.get_or_default() failed: {:?}, falling back to default", err);
dialogue.update(D::default()).await.ok()?;
dialogue.get_or_default().await.ok()
}
}
})

View file

@ -52,7 +52,13 @@ where
/// 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
/// [`Cbor`]: crate::dispatching::dialogue::serializer::Cbor
/// [`Json`]: crate::dispatching::dialogue::serializer::Json
/// [`Message`]: crate::types::Message
#[cfg(feature = "bincode-serializer")]
pub struct Bincode;