From e2d58c295951e094fef619f5c45cf46c36b29d16 Mon Sep 17 00:00:00 2001 From: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Date: Tue, 5 Jul 2022 12:01:54 -0600 Subject: [PATCH] release lock on update progress (#1614) --- backend/src/install/progress.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/src/install/progress.rs b/backend/src/install/progress.rs index 4eba3bc5b..4d160748b 100644 --- a/backend/src/install/progress.rs +++ b/backend/src/install/progress.rs @@ -44,10 +44,14 @@ impl InstallProgress { mut db: Db, ) -> Result<(), Error> { while !self.download_complete.load(Ordering::SeqCst) { - model.put(&mut db, &self).await?; + let mut tx = db.begin().await?; + model.put(&mut tx, &self).await?; + tx.save().await?; tokio::time::sleep(Duration::from_secs(1)).await; } - model.put(&mut db, &self).await?; + let mut tx = db.begin().await?; + model.put(&mut tx, &self).await?; + tx.save().await?; Ok(()) } pub async fn track_download_during< @@ -74,10 +78,14 @@ impl InstallProgress { complete: Arc, ) -> Result<(), Error> { while !complete.load(Ordering::SeqCst) { - model.put(&mut db, &self).await?; + let mut tx = db.begin().await?; + model.put(&mut tx, &self).await?; + tx.save().await?; tokio::time::sleep(Duration::from_secs(1)).await; } - model.put(&mut db, &self).await?; + let mut tx = db.begin().await?; + model.put(&mut tx, &self).await?; + tx.save().await?; Ok(()) } pub async fn track_read_during<