Wire admin studio SSR and search infrastructure
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Services\Uploads\UploadQueueService;
|
||||
use App\Services\Uploads\UploadPipelineService;
|
||||
use App\Jobs\AnalyzeArtworkAiAssistJob;
|
||||
use App\Jobs\AutoTagArtworkJob;
|
||||
@@ -30,11 +31,12 @@ final class GenerateDerivativesJob implements ShouldQueue
|
||||
private readonly ?string $archiveSessionId = null,
|
||||
private readonly ?string $archiveHash = null,
|
||||
private readonly ?string $archiveOriginalFileName = null,
|
||||
private readonly array $additionalScreenshotSessions = []
|
||||
private readonly array $additionalScreenshotSessions = [],
|
||||
private readonly ?int $batchItemId = null,
|
||||
) {
|
||||
}
|
||||
|
||||
public function handle(UploadPipelineService $pipeline): void
|
||||
public function handle(UploadPipelineService $pipeline, UploadQueueService $queue): void
|
||||
{
|
||||
$pipeline->processAndPublish(
|
||||
$this->sessionId,
|
||||
@@ -47,10 +49,27 @@ final class GenerateDerivativesJob implements ShouldQueue
|
||||
$this->additionalScreenshotSessions
|
||||
);
|
||||
|
||||
if ($this->batchItemId) {
|
||||
$queue->markItemMediaProcessed($this->batchItemId);
|
||||
}
|
||||
|
||||
// Auto-tagging is async and must never block publish.
|
||||
AutoTagArtworkJob::dispatch($this->artworkId, $this->hash)->afterCommit();
|
||||
DetectArtworkMaturityJob::dispatch($this->artworkId, $this->hash)->afterCommit();
|
||||
GenerateArtworkEmbeddingJob::dispatch($this->artworkId, $this->hash)->afterCommit();
|
||||
AnalyzeArtworkAiAssistJob::dispatch($this->artworkId)->afterCommit();
|
||||
}
|
||||
|
||||
public function failed(\Throwable $exception): void
|
||||
{
|
||||
if (! $this->batchItemId) {
|
||||
return;
|
||||
}
|
||||
|
||||
app(UploadQueueService::class)->markItemFailed(
|
||||
$this->batchItemId,
|
||||
'derivatives_failed',
|
||||
$exception->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user