hotfix: disable transactions for now
This commit is contained in:
parent
600918a27e
commit
bc77c993a9
1 changed files with 8 additions and 6 deletions
|
@ -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<RwLock<()>>,
|
||||
transaction_lock: Arc<Mutex<()>>,
|
||||
pub vault_path: Arc<PathBuf>,
|
||||
pub db_path: Arc<PathBuf>,
|
||||
}
|
||||
|
@ -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<ConnectionManager<SqliteConnection>>,
|
||||
transaction_lock: Arc<Mutex<()>>,
|
||||
lock: Arc<RwLock<()>>,
|
||||
vault_path: Arc<PathBuf>,
|
||||
}
|
||||
|
@ -192,8 +188,14 @@ impl UpEndConnection {
|
|||
F: FnOnce() -> Result<T, E>,
|
||||
E: From<Error>,
|
||||
{
|
||||
/*
|
||||
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<S: AsRef<str>>(&self, key: S) -> Result<String> {
|
||||
|
|
Loading…
Reference in a new issue