release lock on update progress (#1614)

This commit is contained in:
Aiden McClelland
2022-07-05 12:01:54 -06:00
committed by GitHub
parent 3cfc333512
commit e2d58c2959

View File

@@ -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<AtomicBool>,
) -> 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<