mirror of
https://github.com/chatmail/core.git
synced 2026-04-23 00:16:34 +03:00
job: perform no more than 20 IMAP jobs in a row
Let the thread load new messages. This may happen when user switches the setting to delete messages on the server on and there are a lot of messages to delete.
This commit is contained in:
10
src/job.rs
10
src/job.rs
@@ -1043,7 +1043,17 @@ pub fn perform_sentbox_jobs(context: &Context) {
|
||||
}
|
||||
|
||||
fn job_perform(context: &Context, thread: Thread, probe_network: bool) {
|
||||
let mut jobs_loaded = 0;
|
||||
|
||||
while let Some(mut job) = load_next_job(context, thread, probe_network) {
|
||||
jobs_loaded += 1;
|
||||
if thread == Thread::Imap && jobs_loaded > 20 {
|
||||
// Let the fetch run, but return back to the job afterwards.
|
||||
info!(context, "postponing {}-job {} to run fetch...", thread, job);
|
||||
*context.perform_inbox_jobs_needed.write().unwrap() = true;
|
||||
break;
|
||||
}
|
||||
|
||||
info!(context, "{}-job {} started...", thread, job);
|
||||
|
||||
// some configuration jobs are "exclusive":
|
||||
|
||||
Reference in New Issue
Block a user