diff --git a/python/tests/test_0_complex_or_slow.py b/python/tests/test_0_complex_or_slow.py index 335d07590..3d4f14e53 100644 --- a/python/tests/test_0_complex_or_slow.py +++ b/python/tests/test_0_complex_or_slow.py @@ -228,14 +228,26 @@ def test_fetch_existing(acfactory, lp, mvbox_move): assert_folders_configured(ac1_clone) lp.sec("check that ac2 contact was fetchted during configure") + for ev in ac1_clone._evtracker.iter_events(): + if ev.name == "DC_EVENT_INFO" and "Started fetching existing contacts." in ev.data2: + break ac1_clone._evtracker.get_matching("DC_EVENT_CONTACTS_CHANGED") ac2_addr = ac2.get_config("addr") assert any(c.addr == ac2_addr for c in ac1_clone.get_contacts()) + for ev in ac1_clone._evtracker.iter_events(): + if ev.name == "DC_EVENT_INFO" and "Done fetching existing contacts." in ev.data2: + break assert_folders_configured(ac1_clone) lp.sec("check that messages changed events arrive for the correct message") + for ev in ac1_clone._evtracker.iter_events(): + if ev.name == "DC_EVENT_INFO" and "Started fetching existing messages." in ev.data2: + break msg = ac1_clone._evtracker.wait_next_messages_changed() assert msg.text == "message text" + for ev in ac1_clone._evtracker.iter_events(): + if ev.name == "DC_EVENT_INFO" and "Done fetching existing messages." in ev.data2: + break assert_folders_configured(ac1) assert_folders_configured(ac1_clone) diff --git a/src/imap.rs b/src/imap.rs index af97cd9ec..1118b309c 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -919,11 +919,14 @@ impl Imap { } self.prepare(context).await.context("could not connect")?; + info!(context, "Started fetching existing contacts."); add_all_recipients_as_contacts(context, self, Config::ConfiguredSentboxFolder).await?; add_all_recipients_as_contacts(context, self, Config::ConfiguredMvboxFolder).await?; add_all_recipients_as_contacts(context, self, Config::ConfiguredInboxFolder).await?; + info!(context, "Done fetching existing contacts."); if context.get_config_bool(Config::FetchExistingMsgs).await? { + info!(context, "Started fetching existing messages."); for config in &[ Config::ConfiguredMvboxFolder, Config::ConfiguredInboxFolder, @@ -935,9 +938,11 @@ impl Imap { .context("could not fetch messages")?; } } + info!(context, "Done fetching existing messages."); + } else { + info!(context, "Not fetching existing messages."); } - info!(context, "Done fetching existing messages."); context .set_config_bool(Config::FetchedExistingMsgs, true) .await?;