/** * Receive end result * Remove task from queue * Free Worker * @param string $workerId * @param string $taskId * @param mixed $result * @return function * @author Andraz <*****@*****.**> */ public function done($workerId, $taskId, $result) { file_put_contents('result.log', "Worker {$workerId} finished task {$taskId} with result {$result}" . PHP_EOL, FILE_APPEND); $task = $this->storage->getTask($taskId); $task->setStatus('done'); $this->storage->saveTask($task); $worker = $this->storage->getWorker($workerId); $worker->setStatus('free'); $this->storage->saveWorker($worker); return 'ok'; }