From 00aa54783f6333800942dbfa74afa7eb8a054059 Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Wed, 4 Dec 2024 12:24:35 +0700 Subject: [PATCH] Revert "give surrealdb a mutex lock" This reverts commit 59fcf92b5365923806cf66e087ead3d32ea0aca4. --- skystreamer-bin/src/exporter.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/skystreamer-bin/src/exporter.rs b/skystreamer-bin/src/exporter.rs index 9451220..dc2b70c 100644 --- a/skystreamer-bin/src/exporter.rs +++ b/skystreamer-bin/src/exporter.rs @@ -177,14 +177,12 @@ pub trait Exporter { } pub struct SurrealDbExporter { - db: Arc>>, + db: Box>, } impl SurrealDbExporter { pub fn new(db: Surreal) -> Self { - SurrealDbExporter { - db: Arc::new(tokio::sync::Mutex::new(db)), - } + SurrealDbExporter { db: Box::new(db) } } } @@ -297,9 +295,6 @@ impl Exporter for SurrealDbExporter { let db = self.db.clone(); let post = post.clone(); tokio::spawn(async move { - // note: Locking the database here for some reason fixes - // timing issues with the database - let db = db.lock().await; let post_rep: crate::surreal_types::SurrealPostRep = post.clone().into(); let res: Option = db .upsert((POSTS_TABLE, &post.id.to_string()))