$run_cron = !array_key_exists('n', $options) && !array_key_exists('no_cron', $options);
-$process = DI::process()->create(getmypid());
+$process = DI::process()->create(getmypid(), basename(__FILE__));
Worker::processQueue($run_cron, $process);
DBA::connect();
DI::flushLogger();
- $process = DI::process()->create(getmypid());
+ $process = DI::process()->create(getmypid(), basename(__FILE__));
$cycles = 0;
while (!self::IPCJobsExists($process->pid) && (++$cycles < 100)) {
/**
* Starts and Returns the process for a given PID
*
- * @param int $pid
+ * @param int $pid
+ * @param string $command
*
* @return Entity\Process
*/
- public function create(int $pid): Entity\Process
+ public function create(int $pid, string $command): Entity\Process
{
// Cleanup inactive process
$this->deleteInactive();
try {
$this->db->transaction();
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
- $last = $trace[count($trace) - 1];
-
- $command = strtolower(basename($last['file']));
-
$newProcess = $this->factory->create($pid, $command);
if (!$this->db->exists('process', ['pid' => $pid])) {
}
}
$this->db->close($processes);
+ $this->db->commit();
} catch (\Exception $exception) {
+ $this->db->rollback();
throw new ProcessPersistenceException('Cannot delete inactive process', $exception);
- } finally {
- $this->db->commit();
}
}