1
0
Fork 0
mirror of https://gitlab.com/famedly/conduit.git synced 2025-06-27 16:35:59 +00:00

change fairmutex to mutex

This commit is contained in:
Jonathan de Jong 2021-07-11 21:48:55 +02:00
parent 7e9014d5c9
commit caa0cbfe1d

View file

@ -16,7 +16,7 @@ use super::{DatabaseEngine, Tree};
use log::debug; use log::debug;
use crossbeam::channel::{bounded, Sender as ChannelSender}; use crossbeam::channel::{bounded, Sender as ChannelSender};
use parking_lot::{FairMutex, FairMutexGuard, Mutex, MutexGuard, RwLock}; use parking_lot::{Mutex, MutexGuard, RwLock};
use rusqlite::{params, Connection, DatabaseName::Main, OptionalExtension}; use rusqlite::{params, Connection, DatabaseName::Main, OptionalExtension};
use tokio::sync::oneshot::Sender; use tokio::sync::oneshot::Sender;
@ -33,7 +33,7 @@ use tokio::sync::oneshot::Sender;
// "SELECT key, value FROM {} WHERE key <= ? ORDER BY DESC"; // "SELECT key, value FROM {} WHERE key <= ? ORDER BY DESC";
struct Pool { struct Pool {
writer: FairMutex<Connection>, writer: Mutex<Connection>,
readers: Vec<Mutex<Connection>>, readers: Vec<Mutex<Connection>>,
spill_tracker: Arc<()>, spill_tracker: Arc<()>,
path: PathBuf, path: PathBuf,
@ -59,7 +59,7 @@ impl<'a> Deref for HoldingConn<'a> {
impl Pool { impl Pool {
fn new<P: AsRef<Path>>(path: P, num_readers: usize, cache_size: u32) -> Result<Self> { fn new<P: AsRef<Path>>(path: P, num_readers: usize, cache_size: u32) -> Result<Self> {
let writer = FairMutex::new(Self::prepare_conn(&path, Some(cache_size))?); let writer = Mutex::new(Self::prepare_conn(&path, Some(cache_size))?);
let mut readers = Vec::new(); let mut readers = Vec::new();
@ -93,7 +93,7 @@ impl Pool {
Ok(conn) Ok(conn)
} }
fn write_lock(&self) -> FairMutexGuard<'_, Connection> { fn write_lock(&self) -> MutexGuard<'_, Connection> {
self.writer.lock() self.writer.lock()
} }