mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-12-25 17:35:51 -05:00
improvement: move sqlite connection acquisition into blocking thread
This commit is contained in:
parent
cec501b37f
commit
3fcaf97a15
|
@ -282,9 +282,11 @@ impl NostrRepo for SqliteRepo {
|
|||
let start = Instant::now();
|
||||
let _write_guard = self.write_in_progress.lock().await;
|
||||
// spawn a blocking thread
|
||||
let mut conn = self.write_pool.get()?;
|
||||
//let mut conn = self.write_pool.get()?;
|
||||
let pool = self.write_pool.clone();
|
||||
let e = e.clone();
|
||||
let event_count = task::spawn_blocking(move || {
|
||||
let mut conn = pool.get()?;
|
||||
SqliteRepo::persist_event(&mut conn, &e)
|
||||
}).await?;
|
||||
self.metrics
|
||||
|
|
Loading…
Reference in New Issue
Block a user