Skip to content

JobExecutor

Shared retry/backoff decision logic used by both SyncQueueDriver (in-process blocking retry loop) and QueueWorker (one attempt per poll, deferred retry via the driver), so the policy is not duplicated per driver.

Jobs are rebuilt per attempt via Container::make() — the same fresh-per-call autowiring actions/views already get.

final readonly class JobExecutor

SourceJobExecutor.php

public function __construct(Container $container, FailedJobStoreInterface $failedJobStore, int $defaultMaxAttempts = 3, int $defaultBackoffSeconds = 5): mixed

ParameterTypeDescription
$containerContainer
$failedJobStoreFailedJobStoreInterface
$defaultMaxAttemptsint
$defaultBackoffSecondsint

Returns mixed

MethodDescription
attempt(JobPayload $payload): ?ExecutionFailureConstruct and run the job once.
executeWithRetries(JobPayload $payload): voidRun a job to completion in-process, blocking (with usleep) between retries.

public function attempt(JobPayload $payload): ?ExecutionFailure

Construct and run the job once.

Returns null on success, or an ExecutionFailure describing whether to retry (with delay) or give up (already recorded to the failed-job store in that case).

ParameterTypeDescription
$payloadJobPayload

Returns ?ExecutionFailure

public function executeWithRetries(JobPayload $payload): void

Run a job to completion in-process, blocking (with usleep) between retries.

Used by SyncQueueDriver only — a persistent driver’s worker loop instead defers retries via release() (see QueueWorker).

ParameterTypeDescription
$payloadJobPayload