30 $DIC->backgroundTasks()->persistence()->saveBucketAndItsTasks($bucket);
32 $DIC->logger()->root()->info(
"[BackgroundTasks] Trying to call webserver");
35 $soap_client = new \ilSoapClient();
36 $soap_client->setResponseTimeout(1);
37 $soap_client->enableWSDL(
true);
39 $session_id = session_id();
40 $ilClientId =
$_COOKIE[
'ilClientId'];
41 $call = $soap_client->call(self::CMD_START_WORKER, array(
42 $session_id .
'::' . $ilClientId,
44 $DIC->logger()->root()->info(
"[BackgroundTasks] After SOAP Call");
45 $DIC->logger()->root()->info(var_export($call,
true));
53 $n_of_tasks = $ilIliasIniFile->readVariable(
"background_tasks",
"number_of_concurrent_tasks");
54 $n_of_tasks = $n_of_tasks ? $n_of_tasks : 5;
56 $DIC->logger()->root()->info(
"[BackgroundTask] Starting background job.");
60 $MAX_PARALLEL_JOBS = $n_of_tasks;
62 $DIC->logger()->root()->info(
"[BackgroundTask] Too many running jobs, worker going down.");
75 $task = $bucket->getTask();
80 $this->persistence->updateBucket($bucket);
83 $this->persistence->deleteBucket($bucket);
86 $this->persistence->saveBucketAndItsTasks($bucket);
89 $DIC->logger()->root()->info(
"[BackgroundTasks] Exception while async computing: " 91 $DIC->logger()->root()->info(
"[BackgroundTasks] Stack Trace: " 92 . $e->getTraceAsString());
96 $DIC->logger()->root()->info(
"[BackgroundTasks] One worker going down because there's nothing left to do.");
executeTask(Task $task, Observer $observer)
Actually executes a task.
Class PersistingObserver.
run(Bucket $bucket)
This will add an Observer of the Task and start running the task.