byos_laravel/app/Jobs/GenerateScreenJob.php
zv0n 580a5833a8 Add image caching for playlist items
Move current_image caching to plugins

Remove redundant check

Add test for plugin cache

Skip puppeteer on GH actions
2025-05-11 20:56:55 +02:00

36 lines
923 B
PHP

<?php
namespace App\Jobs;
use App\Models\Device;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class GenerateScreenJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct(
private readonly int $deviceId,
private readonly string $markup
) {}
/**
* Execute the job.
*/
public function handle(): void
{
$newImageUuid = CommonFunctions::generateImage($this->markup);
Device::find($this->deviceId)->update(['current_screen_image' => $newImageUuid]);
\Log::info("Device $this->deviceId: updated with new image: $newImageUuid");
CommonFunctions::cleanupFolder();
}
}