Files
dreamstudio/app/Jobs/GenerateVideoJob.php
T

35 lines
934 B
PHP
Raw Normal View History

<?php
namespace App\Jobs;
use App\Models\Generation;
use App\Services\Runware\GenerationService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Throwable;
class GenerateVideoJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
// Video submission + polling can legitimately take minutes.
public int $timeout = 900;
public int $tries = 1;
public function __construct(public Generation $generation) {}
public function handle(GenerationService $generations): void
{
try {
$generations->processVideo($this->generation);
} catch (Throwable $e) {
$this->generation->update(['status' => 'failed', 'error' => $e->getMessage()]);
throw $e;
}
}
}