diff --git a/src/database/mod.rs b/src/database/mod.rs index 2706147..34f948b 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -28,12 +28,12 @@ use diesel::r2d2::{self, ConnectionManager, PooledConnection}; use diesel::result::{DatabaseErrorKind, Error}; use diesel::sqlite::SqliteConnection; use hierarchies::initialize_hier; -use log::{debug, trace}; use std::convert::{TryFrom, TryInto}; use std::fs; use std::path::{Path, PathBuf}; -use std::sync::{Arc, Mutex, RwLock}; +use std::sync::{Arc, RwLock}; use std::time::Duration; +use tracing::{debug, trace}; #[derive(Debug)] pub struct ConnectionOptions { @@ -78,7 +78,6 @@ pub struct OpenResult { pub struct UpEndDatabase { pool: DbPool, lock: Arc>, - transaction_lock: Arc>, pub vault_path: Arc, pub db_path: Arc, } @@ -122,7 +121,6 @@ impl UpEndDatabase { let db = UpEndDatabase { pool, lock: Arc::new(RwLock::new(())), - transaction_lock: Arc::new(Mutex::new(())), vault_path: Arc::new(dirpath.as_ref().canonicalize()?), db_path: Arc::new(upend_path), }; @@ -169,7 +167,6 @@ impl UpEndDatabase { Ok(UpEndConnection { conn: self.pool.get()?, lock: self.lock.clone(), - transaction_lock: self.transaction_lock.clone(), vault_path: self.vault_path.clone(), }) } @@ -177,7 +174,6 @@ impl UpEndDatabase { pub struct UpEndConnection { conn: PooledConnection>, - transaction_lock: Arc>, lock: Arc>, vault_path: Arc, } @@ -192,8 +188,14 @@ impl UpEndConnection { F: FnOnce() -> Result, E: From, { + /* + let span = span!(tracing::Level::TRACE, "transaction"); + let _span = span.enter(); let _lock = self.transaction_lock.lock().unwrap(); self.conn.exclusive_transaction(f) + */ + // Disable transactions for now. + f() } pub fn get_meta>(&self, key: S) -> Result {