Commit bbab16ce authored by Timo Bühlmann's avatar Timo Bühlmann
Browse files

feat: add helper to execution-entity

parent 15ce739a
......@@ -129,7 +129,7 @@ class ExecuteCommand extends Command
$cronJob = $this->cronJobManager->getCronJob($input->getArgument('cron_job'));
// Build command to execute
$arguments = $this->prepareArguments($cronJob);
$arguments = $this->applyLastExecutionTimestamp($cronJob);
$command = array_merge(['bin/console', $cronJob->getCommand(), '--env='.$this->environment], $arguments);
// Create execution
......
......@@ -358,6 +358,16 @@ class Execution
return $this;
}
public function getRuntime(): int
{
$startedAt = $this->getStartedAt();
$finishedAt = $this->getFinishedAt();
if ($startedAt && $finishedAt) {
return $finishedAt->getTimestamp() - $startedAt->getTimestamp();
}
return -1;
}
/**
* @return string
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment