mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
release lock on update progress (#1614)
This commit is contained in:
@@ -44,10 +44,14 @@ impl InstallProgress {
|
|||||||
mut db: Db,
|
mut db: Db,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
while !self.download_complete.load(Ordering::SeqCst) {
|
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;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub async fn track_download_during<
|
pub async fn track_download_during<
|
||||||
@@ -74,10 +78,14 @@ impl InstallProgress {
|
|||||||
complete: Arc<AtomicBool>,
|
complete: Arc<AtomicBool>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
while !complete.load(Ordering::SeqCst) {
|
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;
|
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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub async fn track_read_during<
|
pub async fn track_read_during<
|
||||||
|
|||||||
Reference in New Issue
Block a user