Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API to wait for initial messages sync on startup #197

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
Skip timeout
gferon committed Oct 9, 2023
commit 8b6e547e42615d54cc4c5afe82c3f2cbe712130a
13 changes: 1 addition & 12 deletions presage/src/manager.rs
Original file line number Diff line number Diff line change
@@ -631,19 +631,8 @@ impl<C: Store> Manager<C, Registered> {
}

async fn sync_contacts(&mut self) -> Result<(), Error<C::Error>> {
let messages = self.receive_messages_stream(true).await?;
pin_mut!(messages);

let _messages = self.receive_messages_stream(true).await?;
self.request_contacts_sync().await?;

info!("waiting for contacts sync for up to 60 seconds");

tokio::time::timeout(Duration::from_secs(60), async move {
while messages.next().await.is_some() {}
})
.await
.map_err(Error::from)?;

Ok(())
}