fix(settings): drop a link send whose chat settings could not be read

The pipeline read settings through get(), which degrades a failed read to
defaults. A send then went out with the chat's channel forward and
edit-before-forward silently ignored, and the task it built carried those
defaults into the retry payload. try_get() is the strict read; an
unreadable row now drops the send and tells the user.
This commit is contained in:
2026-10-14 22:10:36 +08:00
parent 3a944c1361
commit 2ffe647939
3 changed files with 62 additions and 3 deletions
+8
View File
@@ -112,6 +112,14 @@ impl ChatStore {
self.load(chat_id).await.unwrap_or_default()
}
/// Strict read for callers whose *behavior* depends on the settings. A
/// send that reads them via [`Self::get`] would silently use the defaults
/// on a failed read — no channel forward, no edit prompt — and persist
/// those defaults into the retry payload it builds.
pub async fn try_get(&self, chat_id: i64) -> Result<ChatData, ()> {
self.load(chat_id).await
}
/// Write-through: update the cache and the DB. Returns whether the DB
/// write landed: the cache is updated either way, so `false` means the
/// change lives only until the next restart and the caller has to say so