fix: correctly set a Request::RunState::job_run flag to the background request

The flag should be set to the task.request and not to the cur->request.
The cur->request could have been already changed by the main thread.
This commit is contained in:
Tomasz Sowa 2023-08-25 16:24:27 +02:00
parent cf383fa026
commit 6d256e6512
Signed by: tomasz.sowa
GPG Key ID: 662CC1438638588B
1 changed files with 4 additions and 10 deletions

View File

@ -273,26 +273,20 @@ void Job::DoJob(JobTask & task, size_t priority)
if( task.request )
Cur local_cur;
// is this correct? we can read the task.request->session ... from the second thread?
// chyba tak bo ta struktura zostaje na stosie specjalnie dla joba do uzytku
local_cur.request = task.request;
local_cur.request->run_state = Request::RunState::job_run;
local_cur.session = task.request->session;
local_cur.mount = task.request->mount;
cur->request->run_state = Request::RunState::job_run;
res = plugin->Call(model_connector, &log, &local_cur, WINIX_JOB, &task.job, nullptr, task.job_type, task.job_id);
log << logsave;
Winix::Lock lock(synchro);
cur->request = local_cur.request;
cur->session = local_cur.session;
cur->mount = local_cur.mount;
// winix templates functions uses its own cur (global pointer in TemplatesFunctions namespace)
// so we have to set it correctly
Cur old_cur = *cur;
*cur = local_cur;
DoRequestContinuationJob(task, priority);
*cur = old_cur;