mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
async sleep
This commit is contained in:
@@ -82,7 +82,7 @@ async fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
ctx.configure().await;
|
ctx.configure().await;
|
||||||
|
|
||||||
thread::sleep(duration);
|
async_std::task::sleep(duration).await;
|
||||||
|
|
||||||
println!("sending a message");
|
println!("sending a message");
|
||||||
let contact_id = Contact::create(&ctx, "dignifiedquire", "dignifiedquire@gmail.com").unwrap();
|
let contact_id = Contact::create(&ctx, "dignifiedquire", "dignifiedquire@gmail.com").unwrap();
|
||||||
@@ -101,7 +101,7 @@ async fn main() {
|
|||||||
println!("chat: {} - {:?} - {:?}", i, text1, text2,);
|
println!("chat: {} - {:?} - {:?}", i, text1, text2,);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread::sleep(duration);
|
async_std::task::sleep(duration).await;
|
||||||
|
|
||||||
println!("stopping threads");
|
println!("stopping threads");
|
||||||
|
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ impl Imap {
|
|||||||
// not have entered idle_wait yet, give it some time
|
// not have entered idle_wait yet, give it some time
|
||||||
// for that to happen. XXX handle this without extra wait
|
// for that to happen. XXX handle this without extra wait
|
||||||
// https://github.com/deltachat/deltachat-core-rust/issues/925
|
// https://github.com/deltachat/deltachat-core-rust/issues/925
|
||||||
std::thread::sleep(Duration::from_millis(200));
|
async_std::task::sleep(Duration::from_millis(200)).await;
|
||||||
info!(context, "low-level: dropping stop-source to interrupt idle");
|
info!(context, "low-level: dropping stop-source to interrupt idle");
|
||||||
std::mem::drop(interrupt)
|
std::mem::drop(interrupt)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ pub async fn perform_smtp_jobs(context: &Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn perform_smtp_idle(context: &Context) {
|
pub async fn perform_smtp_idle(context: &Context) {
|
||||||
info!(context, "SMTP-idle started...",);
|
info!(context, "SMTP-idle started...");
|
||||||
|
|
||||||
let perform_jobs_needed = context.smtp.state.read().await.perform_jobs_needed.clone();
|
let perform_jobs_needed = context.smtp.state.read().await.perform_jobs_needed.clone();
|
||||||
|
|
||||||
@@ -1027,7 +1027,7 @@ async fn suspend_smtp_thread(context: &Context, suspend: bool) {
|
|||||||
if !context.smtp.state.read().await.doing_jobs {
|
if !context.smtp.state.read().await.doing_jobs {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::thread::sleep(time::Duration::from_micros(300 * 1000));
|
async_std::task::sleep(time::Duration::from_micros(300 * 1000)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ impl JobThread {
|
|||||||
if !using_handle {
|
if !using_handle {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::thread::sleep(std::time::Duration::from_micros(300 * 1000));
|
async_std::task::sleep(std::time::Duration::from_micros(300 * 1000)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user