Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fixed and error message and properly initialized the DB
Mikayla Maki55eb0a37424e
diff --git a/crates/db/src/db.rs b/crates/db/src/db.rsindex 878d2430e21..704ac4049df 100644--- a/crates/db/src/db.rs+++ b/crates/db/src/db.rs@@ -24,14 +24,14 @@ use util::{async_iife, ResultExt};use util::channel::ReleaseChannel;const CONNECTION_INITIALIZE_QUERY: &'static str = sql!(- PRAGMA synchronous=NORMAL;- PRAGMA busy_timeout=1;PRAGMA foreign_keys=TRUE;- PRAGMA case_sensitive_like=TRUE;);const DB_INITIALIZE_QUERY: &'static str = sql!(PRAGMA journal_mode=WAL;+ PRAGMA busy_timeout=1;+ PRAGMA case_sensitive_like=TRUE;+ PRAGMA synchronous=NORMAL;);const FALLBACK_DB_NAME: &'static str = "FALLBACK_MEMORY_DB";@@ -293,6 +293,7 @@ mod tests {assert!(corrupt_db.persistent());}+let good_db = open_db::<GoodDB>(tempdir.path(), &util::channel::ReleaseChannel::Dev).await;assert!(good_db.select_row::<usize>("SELECT * FROM test2").unwrap()().unwrap().is_none());@@ -339,10 +340,12 @@ mod tests {let tempdir = TempDir::new("DbTests").unwrap();{+ // Setup the bad databaselet corrupt_db = open_db::<CorruptedDB>(tempdir.path(), &util::channel::ReleaseChannel::Dev).await;assert!(corrupt_db.persistent());}+ // Try to connect to it a bunch of times at oncelet mut guards = vec![];for _ in 0..10 {let tmp_path = tempdir.path().to_path_buf();diff --git a/crates/sqlez/src/thread_safe_connection.rs b/crates/sqlez/src/thread_safe_connection.rsindex 51d0707fd8b..2c51b776edc 100644--- a/crates/sqlez/src/thread_safe_connection.rs+++ b/crates/sqlez/src/thread_safe_connection.rs@@ -168,7 +168,7 @@ impl<M: Migrator> ThreadSafeConnection<M> {let result = connection.with_write(|connection| callback(connection));sender.send(result).ok();}));- reciever.map(|response| response.expect("Background writer thread unexpectedly closed"))+ reciever.map(|response| response.expect("Write queue unexpectedly closed"))}pub(crate) fn create_connection(