more sql fixes

This commit is contained in:
dignifiedquire
2019-11-28 18:24:28 +01:00
parent 718f4507b1
commit b1d03e54d9

View File

@@ -764,14 +764,14 @@ fn job_perform(context: &Context, thread: ThreadExecutor, probe_network: bool) {
"j.desired_timestamp AS desired_timestamp, ", "j.desired_timestamp AS desired_timestamp, ",
"j.tries AS tries ", "j.tries AS tries ",
"FROM jobs j ", "FROM jobs j ",
"LEFT JOIN msgs m", "LEFT JOIN msgs m ON j.foreign_id=m.id ",
) )
.to_string(); .to_string();
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.
query_start query_start
+ "WHERE j.thread=? AND j.desired_timestamp<=? " + "WHERE j.thread=? AND j.desired_timestamp<=? AND "
+ "((j.foreign_id IS NOT NULL AND m.server_folder=?) " + "((j.foreign_id IS NOT NULL AND m.server_folder=?) "
+ fallback + fallback
+ "ORDER BY j.action DESC, j.added_timestamp;" + "ORDER BY j.action DESC, j.added_timestamp;"