handle()
класса App\Jobs\MakeRequest.php
проверять статус, и ещё раз выполнять задание?fucntion handle()
{
$response = Http::post($this->url, $this->data);
if ($response->failed()) {
self::dispatch($this->url, $this->data)->delay(now()->addMinutes(5));
}
}
fucntion handle()
{
$response = Http::post($this->url, $this->data);
if ($response->failed()) {
$this->release(360);
}
}
$tries
, а вместо исключения вызывать $this->release()
class MyQueueJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
const TIMEOUT = 10;
public $tries= 288;
public $url;
public $data;
public function __construct(string $url, $data)
{
$this->onQueue('myqueue');
$this->url = $url;
$this->data = $data;
}
public function handle()
{
try {
$response = Http::withOptions(['verify' => false])
->timeout(self::TIMEOUT)
->post($this->url, [$this->data]);
} catch (\Exception $exception) {
$this->release(300);
}
if (isset($response) && $response->failed()) {
$this->release(300);
}
}
}
command=php /laravel/artisan queue:work --queue=myqueue