Every lock of the store goes through Db::conn

Db::conn is documented as the one way to take the lock, yet five production and
test sites reached past it with db.0.lock(): the startup summary, the desktop's
trash sweep and config_get, and tests in sharing and update. All five now call
conn().

DRY pass #2, batch 2, F8 (#5372).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 14:23:07 -04:00
co-authored by Claude Opus 5.5
parent 63dd206b91
commit ee771e3734
5 changed files with 9 additions and 9 deletions
+4 -4
View File
@@ -553,7 +553,7 @@ mod tests {
/// The channel `update_check` would actually use.
fn effective(db: &Db) -> Channel {
let conn = db.0.lock().expect("lock");
let conn = db.conn().expect("lock");
store::pref(&conn, CHANNEL_PREF)
.expect("read pref")
.as_deref()
@@ -562,7 +562,7 @@ mod tests {
}
fn set_channel(db: &Db, channel: Channel) {
let conn = db.0.lock().expect("lock");
let conn = db.conn().expect("lock");
store::set_pref(&conn, CHANNEL_PREF, channel.as_str()).expect("set pref");
}
@@ -702,7 +702,7 @@ mod tests {
}
fn set_server(db: &Db, value: &str) {
let conn = db.0.lock().expect("lock");
let conn = db.conn().expect("lock");
store::set_pref(&conn, SERVER_PREF, value).expect("set pref");
}
@@ -780,7 +780,7 @@ mod tests {
let db = db();
assert_eq!(token_for(&db, "https://notes.example.com"), Ok(None));
{
let conn = db.0.lock().expect("lock");
let conn = db.conn().expect("lock");
state::set_link(&conn, "https://notes.example.com/", "tok").expect("link");
}
assert_eq!(