Changeset View
Changeset View
Standalone View
Standalone View
src/app/Jobs/DomainJob.php
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | abstract class DomainJob extends CommonJob | ||||
* | * | ||||
* @throws \Exception | * @throws \Exception | ||||
*/ | */ | ||||
protected function getDomain() | protected function getDomain() | ||||
{ | { | ||||
$domain = \App\Domain::withTrashed()->find($this->domainId); | $domain = \App\Domain::withTrashed()->find($this->domainId); | ||||
if (!$domain) { | if (!$domain) { | ||||
// The record might not exist yet in case of a db replication environment | |||||
// This will release the job and delay another attempt for 5 seconds | |||||
if ($this instanceof Domain\CreateJob) { | |||||
$this->release(5); | |||||
return null; | |||||
} | |||||
$this->fail(new \Exception("Domain {$this->domainId} could not be found in the database.")); | $this->fail(new \Exception("Domain {$this->domainId} could not be found in the database.")); | ||||
} | } | ||||
return $domain; | return $domain; | ||||
} | } | ||||
} | } |