mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-09 20:11:04 +01:00
less warnings
This commit is contained in:
parent
5173d0deb5
commit
665aee11c0
2 changed files with 3 additions and 39 deletions
|
@ -12,9 +12,7 @@ use std::{
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
use tokio::sync::oneshot::Sender;
|
use tokio::sync::oneshot::Sender;
|
||||||
use tracing::{debug, warn};
|
use tracing::debug;
|
||||||
|
|
||||||
pub const MILLI: Duration = Duration::from_millis(1);
|
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static READ_CONNECTION: RefCell<Option<&'static Connection>> = RefCell::new(None);
|
static READ_CONNECTION: RefCell<Option<&'static Connection>> = RefCell::new(None);
|
||||||
|
@ -164,16 +162,7 @@ impl Tree for SqliteTable {
|
||||||
#[tracing::instrument(skip(self, key, value))]
|
#[tracing::instrument(skip(self, key, value))]
|
||||||
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
|
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()> {
|
||||||
let guard = self.engine.write_lock();
|
let guard = self.engine.write_lock();
|
||||||
|
|
||||||
let start = Instant::now();
|
|
||||||
|
|
||||||
self.insert_with_guard(&guard, key, value)?;
|
self.insert_with_guard(&guard, key, value)?;
|
||||||
|
|
||||||
let elapsed = start.elapsed();
|
|
||||||
if elapsed > MILLI {
|
|
||||||
warn!("insert took {:?} : {}", elapsed, &self.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
drop(guard);
|
drop(guard);
|
||||||
|
|
||||||
let watchers = self.watchers.read();
|
let watchers = self.watchers.read();
|
||||||
|
@ -220,20 +209,11 @@ impl Tree for SqliteTable {
|
||||||
fn remove(&self, key: &[u8]) -> Result<()> {
|
fn remove(&self, key: &[u8]) -> Result<()> {
|
||||||
let guard = self.engine.write_lock();
|
let guard = self.engine.write_lock();
|
||||||
|
|
||||||
let start = Instant::now();
|
|
||||||
|
|
||||||
guard.execute(
|
guard.execute(
|
||||||
format!("DELETE FROM {} WHERE key = ?", self.name).as_str(),
|
format!("DELETE FROM {} WHERE key = ?", self.name).as_str(),
|
||||||
[key],
|
[key],
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let elapsed = start.elapsed();
|
|
||||||
|
|
||||||
if elapsed > MILLI {
|
|
||||||
debug!("remove: took {:012?} : {}", elapsed, &self.name);
|
|
||||||
}
|
|
||||||
// debug!("remove key: {:?}", &key);
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,8 +306,6 @@ impl Tree for SqliteTable {
|
||||||
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
|
fn increment(&self, key: &[u8]) -> Result<Vec<u8>> {
|
||||||
let guard = self.engine.write_lock();
|
let guard = self.engine.write_lock();
|
||||||
|
|
||||||
let start = Instant::now();
|
|
||||||
|
|
||||||
let old = self.get_with_guard(&guard, key)?;
|
let old = self.get_with_guard(&guard, key)?;
|
||||||
|
|
||||||
let new =
|
let new =
|
||||||
|
@ -335,26 +313,11 @@ impl Tree for SqliteTable {
|
||||||
|
|
||||||
self.insert_with_guard(&guard, key, &new)?;
|
self.insert_with_guard(&guard, key, &new)?;
|
||||||
|
|
||||||
let elapsed = start.elapsed();
|
|
||||||
|
|
||||||
if elapsed > MILLI {
|
|
||||||
debug!("increment: took {:012?} : {}", elapsed, &self.name);
|
|
||||||
}
|
|
||||||
// debug!("increment key: {:?}", &key);
|
|
||||||
|
|
||||||
Ok(new)
|
Ok(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(skip(self, prefix))]
|
#[tracing::instrument(skip(self, prefix))]
|
||||||
fn scan_prefix<'a>(&'a self, prefix: Vec<u8>) -> Box<dyn Iterator<Item = TupleOfBytes> + 'a> {
|
fn scan_prefix<'a>(&'a self, prefix: Vec<u8>) -> Box<dyn Iterator<Item = TupleOfBytes> + 'a> {
|
||||||
// let name = self.name.clone();
|
|
||||||
// self.iter_from_thread(
|
|
||||||
// format!(
|
|
||||||
// "SELECT key, value FROM {} WHERE key BETWEEN ?1 AND ?1 || X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' ORDER BY key ASC",
|
|
||||||
// name
|
|
||||||
// )
|
|
||||||
// [prefix]
|
|
||||||
// )
|
|
||||||
Box::new(
|
Box::new(
|
||||||
self.iter_from(&prefix, false)
|
self.iter_from(&prefix, false)
|
||||||
.take_while(move |(key, _)| key.starts_with(&prefix)),
|
.take_while(move |(key, _)| key.starts_with(&prefix)),
|
||||||
|
|
|
@ -721,7 +721,8 @@ pub async fn send_transaction_message_route(
|
||||||
&db.globals,
|
&db.globals,
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else {
|
||||||
warn!("No known event ids in read receipt: {:?}", user_updates);
|
// TODO fetch missing events
|
||||||
|
debug!("No known event ids in read receipt: {:?}", user_updates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue