Skip to content

Commit

Permalink
dispatch to the queue defined
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Jan 12, 2025
1 parent f27376e commit 80edf13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Definitions/MediaConversionDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ public function shouldExecute(Media $media, ?MediaConversion $parent): bool

public function dispatch(Media $media, ?MediaConversion $parent): PendingDispatch
{
return dispatch(new MediaConversionJob(
$job = new MediaConversionJob(
media: $media,
conversion: $parent ? "{$parent->conversion_name}.{$this->name}" : $this->name
));
);

return dispatch($job)->onQueue($this->queue ?? $job->queue);
}

public function execute(Media $media, ?MediaConversion $parent): ?MediaConversion
Expand Down
6 changes: 4 additions & 2 deletions src/Models/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,12 @@ public function dispatchConversion(

if ($definition = $this->getConversionDefinition($conversion)) {

return dispatch(new MediaConversionJob(
$job = new MediaConversionJob(
media: $this,
conversion: $conversion
));
);

return dispatch($job)->onQueue($definition->queue ?? $job->queue);

}

Expand Down

0 comments on commit 80edf13

Please sign in to comment.