Mini Heartbeat
In addition to the heartbeat (executable in a cycle minute by minute), the mini-heartbeat is executed directly right before a step ends, processing with the PipelineRunner (Consumer).
Within the pipeline, it does not wait for the next heartbeat but the following steps, triggered by the Mini Heartbeat but executed immediately.
This steps, which run only seconds or milliseconds, can be executed fast one after the other without waiting for the next heartbeat.
The functionality can be activated with the associated Mini Heartbeat configuration.
Execution function of the mini heartbeat
\TechDivision\ProcessPipelines\Model\MiniHeartbeat::process
/**
* @param int $pipelineId
* @return void
* @throws NoSuchEntityException
* @throws Throwable
*/
public function process(int $pipelineId)
{
if (!$this->isMiniHeartbeatAllowed->execute()) {
return;
}
if ($this->lockManager->isLocked(PipelineHeartbeat::HEARTBEAT_LOCK_KEY)) {
...
return;
}
$lockName = $this->getLockName($pipelineId);
if ($this->lockManager->isLocked($lockName)) {
...
return;
}
$this->lockManager->lock($lockName);
try {
$pipeline = $this->getPipelineById->execute($pipelineId);
$this->executeAllPendingStepsByPipelineCommand->execute($pipeline);
$this->cancelPipelineIfExpiredCommand->execute($pipeline);
$this->updatePipelineStatusCommand->execute($pipeline);
$this->lockManager->unlock($lockName);
} catch (Throwable $throwable) {
$this->lockManager->unlock($lockName);
throw $throwable;
}
}