hotfix: disable transactions for now
parent
600918a27e
commit
bc77c993a9
|
@ -28,12 +28,12 @@ use diesel::r2d2::{self, ConnectionManager, PooledConnection};
|
||||||
use diesel::result::{DatabaseErrorKind, Error};
|
use diesel::result::{DatabaseErrorKind, Error};
|
||||||
use diesel::sqlite::SqliteConnection;
|
use diesel::sqlite::SqliteConnection;
|
||||||
use hierarchies::initialize_hier;
|
use hierarchies::initialize_hier;
|
||||||
use log::{debug, trace};
|
|
||||||
use std::convert::{TryFrom, TryInto};
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use tracing::{debug, trace};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct ConnectionOptions {
|
pub struct ConnectionOptions {
|
||||||
|
@ -78,7 +78,6 @@ pub struct OpenResult {
|
||||||
pub struct UpEndDatabase {
|
pub struct UpEndDatabase {
|
||||||
pool: DbPool,
|
pool: DbPool,
|
||||||
lock: Arc<RwLock<()>>,
|
lock: Arc<RwLock<()>>,
|
||||||
transaction_lock: Arc<Mutex<()>>,
|
|
||||||
pub vault_path: Arc<PathBuf>,
|
pub vault_path: Arc<PathBuf>,
|
||||||
pub db_path: Arc<PathBuf>,
|
pub db_path: Arc<PathBuf>,
|
||||||
}
|
}
|
||||||
|
@ -122,7 +121,6 @@ impl UpEndDatabase {
|
||||||
let db = UpEndDatabase {
|
let db = UpEndDatabase {
|
||||||
pool,
|
pool,
|
||||||
lock: Arc::new(RwLock::new(())),
|
lock: Arc::new(RwLock::new(())),
|
||||||
transaction_lock: Arc::new(Mutex::new(())),
|
|
||||||
vault_path: Arc::new(dirpath.as_ref().canonicalize()?),
|
vault_path: Arc::new(dirpath.as_ref().canonicalize()?),
|
||||||
db_path: Arc::new(upend_path),
|
db_path: Arc::new(upend_path),
|
||||||
};
|
};
|
||||||
|
@ -169,7 +167,6 @@ impl UpEndDatabase {
|
||||||
Ok(UpEndConnection {
|
Ok(UpEndConnection {
|
||||||
conn: self.pool.get()?,
|
conn: self.pool.get()?,
|
||||||
lock: self.lock.clone(),
|
lock: self.lock.clone(),
|
||||||
transaction_lock: self.transaction_lock.clone(),
|
|
||||||
vault_path: self.vault_path.clone(),
|
vault_path: self.vault_path.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -177,7 +174,6 @@ impl UpEndDatabase {
|
||||||
|
|
||||||
pub struct UpEndConnection {
|
pub struct UpEndConnection {
|
||||||
conn: PooledConnection<ConnectionManager<SqliteConnection>>,
|
conn: PooledConnection<ConnectionManager<SqliteConnection>>,
|
||||||
transaction_lock: Arc<Mutex<()>>,
|
|
||||||
lock: Arc<RwLock<()>>,
|
lock: Arc<RwLock<()>>,
|
||||||
vault_path: Arc<PathBuf>,
|
vault_path: Arc<PathBuf>,
|
||||||
}
|
}
|
||||||
|
@ -192,8 +188,14 @@ impl UpEndConnection {
|
||||||
F: FnOnce() -> Result<T, E>,
|
F: FnOnce() -> Result<T, E>,
|
||||||
E: From<Error>,
|
E: From<Error>,
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
let span = span!(tracing::Level::TRACE, "transaction");
|
||||||
|
let _span = span.enter();
|
||||||
let _lock = self.transaction_lock.lock().unwrap();
|
let _lock = self.transaction_lock.lock().unwrap();
|
||||||
self.conn.exclusive_transaction(f)
|
self.conn.exclusive_transaction(f)
|
||||||
|
*/
|
||||||
|
// Disable transactions for now.
|
||||||
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_meta<S: AsRef<str>>(&self, key: S) -> Result<String> {
|
pub fn get_meta<S: AsRef<str>>(&self, key: S) -> Result<String> {
|
||||||
|
|
Loading…
Reference in New Issue