richardhulbert's avatar

Spatie media ConversionHasBeenCompleted not fired from queue

Has anyone noticed that the ConversionHasBeenCompleted event is not fired when the conversion is queued?

I have two media conversions:

 $this->addMediaCollection('image')->withResponsiveImages();
  $this->addMediaConversion('thumb')->width(300)->crop('crop-center', 300, 200)->nonQueued();

when I listen for the ConversionHasBeenCompleted completed event I catch the nonQueued event but not the withResponsiveImages();

here is the listener:

<?php

namespace App\Listeners;

use Spatie\MediaLibrary\Conversions\Events\ConversionHasBeenCompleted;
use Log;

class MediaConversionCompleteListener
{
    public function __construct() {
    }

    public function handle(ConversionHasBeenCompleted $event): void {
        $media = $event->media;
        $path = $media->getPath();
        $conversion = $event->conversion;
        $conversionName = $conversion->getName();

        Log::info("file {$path} has been converted using conversion:{$conversionName} for media {$media->id}");


    }
}

And here is the log entries made when I ad some media:

[2024-07-24 14:52:43] local.INFO: file /Users/richard/PhpstormProjects/spa/storage/app/public/media/30/IMG_4840.HEIC has been saved for media 30  
[2024-07-24 14:52:44] local.INFO: file /Users/richard/PhpstormProjects/spa/storage/app/public/media/30/IMG_4840.HEIC has been converted using conversion:thumb for media 30  

Ideas?

0 likes
1 reply
richardhulbert's avatar

Alas the Larry AI did not solve the issue. with the exception of the of the 'queue_conversions_by_default' => true, everything was already set up. I have made the small change stopped the worker and cleared the cache. I think there is a bug in Spatie Media alas.

Please or to participate in this conversation.