make thread safe connection more thread safe

Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
Kay Simmons 2022-11-30 10:54:01 -08:00 committed by Mikayla Maki
parent 9cd6894dc5
commit a29ccb4ff8
12 changed files with 196 additions and 124 deletions

View file

@ -15,9 +15,9 @@ impl std::ops::Deref for KeyValueStore {
lazy_static::lazy_static! {
pub static ref KEY_VALUE_STORE: KeyValueStore = KeyValueStore(if cfg!(any(test, feature = "test-support")) {
open_memory_db(stringify!($id))
smol::block_on(open_memory_db("KEY_VALUE_STORE"))
} else {
open_file_db()
smol::block_on(open_file_db())
});
}
@ -62,7 +62,7 @@ mod tests {
#[gpui::test]
async fn test_kvp() {
let db = KeyValueStore(crate::open_memory_db("test_kvp"));
let db = KeyValueStore(crate::open_memory_db("test_kvp").await);
assert_eq!(db.read_kvp("key-1").unwrap(), None);