Changeset View
Changeset View
Standalone View
Standalone View
src/app/Jobs/CommonJob.php
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | abstract class CommonJob implements ShouldQueue | ||||
public function release($delay = 0) | public function release($delay = 0) | ||||
{ | { | ||||
// We need this for testing purposes | // We need this for testing purposes | ||||
$this->isReleased = true; | $this->isReleased = true; | ||||
// @phpstan-ignore-next-line | // @phpstan-ignore-next-line | ||||
if ($this->job) { | if ($this->job) { | ||||
$this->job->release($delay); | $this->job->release($delay); | ||||
} else { | |||||
// $this->job is only set when the job is dispatched, not if manually executed by calling handle(). | |||||
// When manually executed, release() does nothing, and we thus throw an exception. | |||||
throw new \Exception("Attempted to release a manually executed job"); | |||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Determine if the job has been deleted. | * Determine if the job has been deleted. | ||||
* | * | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
Show All 15 Lines |