Skip to content

Commit

Permalink
Revert "give surrealdb a mutex lock"
Browse files Browse the repository at this point in the history
This reverts commit 59fcf92.
  • Loading branch information
korewaChino committed Dec 4, 2024
1 parent d580084 commit 00aa547
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions skystreamer-bin/src/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,12 @@ pub trait Exporter {
}

pub struct SurrealDbExporter<C: Connection> {
db: Arc<tokio::sync::Mutex<Surreal<C>>>,
db: Box<Surreal<C>>,
}

impl<C: Connection> SurrealDbExporter<C> {
pub fn new(db: Surreal<C>) -> Self {
SurrealDbExporter {
db: Arc::new(tokio::sync::Mutex::new(db)),
}
SurrealDbExporter { db: Box::new(db) }
}
}

Expand Down Expand Up @@ -297,9 +295,6 @@ impl<C: Connection> Exporter for SurrealDbExporter<C> {
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<crate::surreal_types::SurrealPostRep> = db
.upsert((POSTS_TABLE, &post.id.to_string()))
Expand Down

0 comments on commit 00aa547

Please sign in to comment.