Skip to content

Commit

Permalink
Merge pull request #771 from imobachgs/wait-before-probing
Browse files Browse the repository at this point in the history
Wait before probing
  • Loading branch information
imobachgs authored Sep 26, 2023
2 parents 5069337 + f00379f commit c4392c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rust/agama-lib/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl<'a> ManagerClient<'a> {
}

pub async fn probe(&self) -> Result<(), ServiceError> {
self.wait().await?;
Ok(self.manager_proxy.probe().await?)
}

Expand Down Expand Up @@ -55,12 +56,12 @@ impl<'a> ManagerClient<'a> {

/// Waits until the manager is idle.
pub async fn wait(&self) -> Result<(), ServiceError> {
let mut stream = self.status_proxy.receive_current_changed().await;
if !self.is_busy().await {
return Ok(());
}

let mut s = self.status_proxy.receive_current_changed().await;
while let Some(change) = s.next().await {
while let Some(change) = stream.next().await {
if change.get().await? == 0 {
return Ok(());
}
Expand Down
6 changes: 6 additions & 0 deletions rust/package/agama-cli.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Sep 26 12:05:52 UTC 2023 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Wait until the manager is ready before probing
(gh#openSUSE/agama#771).

-------------------------------------------------------------------
Mon Sep 25 11:32:53 UTC 2023 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down

0 comments on commit c4392c2

Please sign in to comment.