mirror of
https://github.com/chatmail/core.git
synced 2026-05-23 16:56:30 +03:00
fallbackg
This commit is contained in:
39
src/job.rs
39
src/job.rs
@@ -747,26 +747,39 @@ pub fn perform_sentbox_jobs(context: &Context) {
|
|||||||
fn job_perform(context: &Context, thread: ThreadExecutor, probe_network: bool) {
|
fn job_perform(context: &Context, thread: ThreadExecutor, probe_network: bool) {
|
||||||
let folder = get_folder_for_executor(context, thread);
|
let folder = get_folder_for_executor(context, thread);
|
||||||
|
|
||||||
|
let fallback = if thread == ThreadExecutor::Inbox || thread == ThreadExecutor::Smtp {
|
||||||
|
// only select non empty ones on the inbox thread or smtp
|
||||||
|
" OR (j.foreign_id IS NULL))"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
let query = if !probe_network {
|
let query = if !probe_network {
|
||||||
// processing for first-try and after backoff-timeouts:
|
// processing for first-try and after backoff-timeouts:
|
||||||
// process jobs in the order they were added.
|
// process jobs in the order they were added.
|
||||||
"SELECT j.id, j.action, j.foreign_id, j.param, j.added_timestamp, j.desired_timestamp, j.tries \
|
format!(
|
||||||
FROM jobs j \
|
"SELECT j.id, j.action, j.foreign_id, j.param, j.added_timestamp, j.desired_timestamp, j.tries \
|
||||||
LEFT JOIN msgs m\
|
FROM jobs j \
|
||||||
WHERE j.thread=? AND j.desired_timestamp<=? \
|
LEFT JOIN msgs m\
|
||||||
((j.foreign_id NOT NULL AND m.server_folder=?) OR (j.foreign_id IS NULL)) \
|
WHERE j.thread=? AND j.desired_timestamp<=? \
|
||||||
ORDER BY j.action DESC, j.added_timestamp;"
|
((j.foreign_id NOT NULL AND m.server_folder=?) {} \
|
||||||
|
ORDER BY j.action DESC, j.added_timestamp;",
|
||||||
|
fallback
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
// processing after call to dc_maybe_network():
|
// processing after call to dc_maybe_network():
|
||||||
// process _all_ pending jobs that failed before
|
// process _all_ pending jobs that failed before
|
||||||
// in the order of their backoff-times.
|
// in the order of their backoff-times.
|
||||||
"SELECT \
|
format!(
|
||||||
j.id, j.action, j.foreign_id, j.param, j.added_timestamp, j.desired_timestamp, j.tries \
|
"SELECT \
|
||||||
FROM jobs j \
|
j.id, j.action, j.foreign_id, j.param, j.added_timestamp, j.desired_timestamp, j.tries \
|
||||||
LEFT JOIN msgs m \
|
FROM jobs j \
|
||||||
WHERE j.thread=? AND j.tries>0 AND \
|
LEFT JOIN msgs m \
|
||||||
((j.foreign_id NOT NULL AND m.server_folder=?) OR (j.foreign_id IS NULL)) \
|
WHERE j.thread=? AND j.tries>0 AND \
|
||||||
ORDER BY j.desired_timestamp, j.action DESC;"
|
((j.foreign_id NOT NULL AND m.server_folder=?) {} \
|
||||||
|
ORDER BY j.desired_timestamp, j.action DESC;",
|
||||||
|
fallback
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
let params_no_probe = params![thread as i64, time(), folder];
|
let params_no_probe = params![thread as i64, time(), folder];
|
||||||
|
|||||||
Reference in New Issue
Block a user