mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 22:36:30 +03:00
fix dc_job sql call, to reduce contention
This commit is contained in:
@@ -94,9 +94,15 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network:
|
|||||||
params_probe
|
params_probe
|
||||||
};
|
};
|
||||||
|
|
||||||
context.sql.query_map(query, params, process_row, |jobs| {
|
let jobs: Vec<dc_job_t> = context
|
||||||
for job in jobs {
|
.sql
|
||||||
let mut job: dc_job_t = job?;
|
.query_map(query, params, process_row, |jobs| {
|
||||||
|
jobs.collect::<Result<Vec<dc_job_t>, _>>()
|
||||||
|
.map_err(Into::into)
|
||||||
|
})
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
for mut job in jobs {
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
0,
|
0,
|
||||||
@@ -223,9 +229,6 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network:
|
|||||||
dc_param_unref(job.param);
|
dc_param_unref(job.param);
|
||||||
free(job.pending_error as *mut libc::c_void);
|
free(job.pending_error as *mut libc::c_void);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}); // TODO: better error handling
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dc_job_delete(context: &Context, job: &dc_job_t) -> bool {
|
fn dc_job_delete(context: &Context, job: &dc_job_t) -> bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user