mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
Change the order of job processing
This commit is contained in:
22
src/job.rs
22
src/job.rs
@@ -976,17 +976,19 @@ pub fn interrupt_smtp_idle(context: &Context) {
|
|||||||
/// jobs, this is tricky and probably wrong currently. Look at the
|
/// jobs, this is tricky and probably wrong currently. Look at the
|
||||||
/// SQL queries for details.
|
/// SQL queries for details.
|
||||||
fn load_jobs(context: &Context, thread: Thread, probe_network: bool) -> Vec<Job> {
|
fn load_jobs(context: &Context, thread: Thread, probe_network: bool) -> Vec<Job> {
|
||||||
let query = if !probe_network {
|
let query = if probe_network {
|
||||||
// processing for first-try and after backoff-timeouts:
|
// Processing after call to dc_maybe_network():
|
||||||
// process jobs in the order they were added.
|
// process all pending jobs in the order of their priority.
|
||||||
"SELECT id, action, foreign_id, param, added_timestamp, desired_timestamp, tries \
|
// If jobs have the same priority, process the
|
||||||
FROM jobs WHERE thread=? AND desired_timestamp<=? ORDER BY action DESC, added_timestamp;"
|
// one that was added earlier.
|
||||||
|
"SELECT id, action, foreign_id, param, added_timestamp, desired_timestamp, tries
|
||||||
|
FROM jobs WHERE thread=? ORDER BY action DESC, added_timestamp;"
|
||||||
} else {
|
} else {
|
||||||
// processing after call to dc_maybe_network():
|
// Processing for the first try and after backoff-timeouts:
|
||||||
// process _all_ pending jobs that failed before
|
// process jobs that have their backoff expired
|
||||||
// in the order of their backoff-times.
|
// in the order of their backoff times.
|
||||||
"SELECT id, action, foreign_id, param, added_timestamp, desired_timestamp, tries \
|
"SELECT id, action, foreign_id, param, added_timestamp, desired_timestamp, tries
|
||||||
FROM jobs WHERE thread=? ORDER BY desired_timestamp, action DESC;"
|
FROM jobs WHERE thread=? AND desired_timestamp<=? ORDER BY desired_timestamp;"
|
||||||
};
|
};
|
||||||
|
|
||||||
let params_no_probe = params![thread as i64, time()];
|
let params_no_probe = params![thread as i64, time()];
|
||||||
|
|||||||
Reference in New Issue
Block a user