feat(#194): refactor cache to be device specific

This commit is contained in:
Benjamin Nussbaum 2026-02-27 17:38:28 +01:00
parent c194ab5db1
commit 26b5f3ceb1
8 changed files with 278 additions and 110 deletions

View file

@ -34,8 +34,13 @@ class GenerateScreenJob implements ShouldQueue
Device::find($this->deviceId)->update(['current_screen_image' => $newImageUuid]);
if ($this->pluginId) {
// cache current image
Plugin::find($this->pluginId)->update(['current_image' => $newImageUuid]);
$plugin = Plugin::find($this->pluginId);
$update = ['current_image' => $newImageUuid];
if ($plugin->plugin_type === 'recipe') {
$device = Device::with(['deviceModel', 'deviceModel.palette'])->find($this->deviceId);
$update['current_image_metadata'] = ImageGenerationService::buildImageMetadataFromDevice($device);
}
$plugin->update($update);
}
ImageGenerationService::cleanupFolder();