Skip to content

Commit

Permalink
Wait to log in before starting background tasks (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulyssa authored Mar 29, 2024
1 parent 2327658 commit 5a2a7b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ async fn login_normal(
) -> IambResult<()> {
println!("* Logging in for {}...", settings.profile.user_id);
login(worker, settings).await?;
println!("* Syncing...");
worker::do_first_sync(&worker.client, store)
.await
.map_err(IambError::from)?;
Expand Down
4 changes: 4 additions & 0 deletions src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,10 @@ impl ClientWorker {
let settings = self.settings.clone();

async move {
while !client.logged_in() {
tokio::time::sleep(Duration::from_millis(100)).await;
}

let load = load_older_forever(&client, &store);
let rcpt = send_receipts_forever(&client, &store);
let room = refresh_rooms_forever(&client, &store);
Expand Down

0 comments on commit 5a2a7b0

Please sign in to comment.