Skip to content
docsv0.1.1

CronRunner

Executes every {@see TaskDefinition} due at a given instant. Each due task is timed and run in isolation: a `Throwable` from one callback is caught, recorded as a failing {@see TaskResult}, optionally logged, and never stops the runner from moving on to the next due task. A task that is not due at `$now` (see {@see CronRegistry::due()}) is never invoked and never appears in the resulting {@see CronReport}.

CronRunner::__construct()

public function __construct(Milpa\Ops\Cron\CronRegistry $registry, ?Psr\Log\LoggerInterface $logger = null):

Parameters

Parameters of __construct()
NameTypeDescription
$registryMilpa\Ops\Cron\CronRegistry
$logger?Psr\Log\LoggerInterface

CronRunner::run()

public function run(DateTimeImmutable $now): Milpa\Ops\Cron\CronReport

Runs every task due at `$now`, in registration order, and reports what happened. Never throws itself — a failing task's exception is captured in its `TaskResult` instead of propagating out of `run()`.

Parameters

Parameters of run()
NameTypeDescription
$nowDateTimeImmutable