Skip to content

Commit 5a2a7b0

Browse files
authored
Wait to log in before starting background tasks (#234)
1 parent 2327658 commit 5a2a7b0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ async fn login_normal(
898898
) -> IambResult<()> {
899899
println!("* Logging in for {}...", settings.profile.user_id);
900900
login(worker, settings).await?;
901+
println!("* Syncing...");
901902
worker::do_first_sync(&worker.client, store)
902903
.await
903904
.map_err(IambError::from)?;

src/worker.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,10 @@ impl ClientWorker {
12171217
let settings = self.settings.clone();
12181218

12191219
async move {
1220+
while !client.logged_in() {
1221+
tokio::time::sleep(Duration::from_millis(100)).await;
1222+
}
1223+
12201224
let load = load_older_forever(&client, &store);
12211225
let rcpt = send_receipts_forever(&client, &store);
12221226
let room = refresh_rooms_forever(&client, &store);

0 commit comments

Comments
 (0)