mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56: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
|
||||
};
|
||||
|
||||
context.sql.query_map(query, params, process_row, |jobs| {
|
||||
for job in jobs {
|
||||
let mut job: dc_job_t = job?;
|
||||
let jobs: Vec<dc_job_t> = context
|
||||
.sql
|
||||
.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!(
|
||||
context,
|
||||
0,
|
||||
@@ -223,9 +229,6 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network:
|
||||
dc_param_unref(job.param);
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user