From 0f60cc852cf2cc641f79e69606dcfb96f193b19a Mon Sep 17 00:00:00 2001 From: freek Date: Thu, 1 Oct 2015 23:59:00 +0200 Subject: [PATCH] use custom queue --- CHANGELOG.md | 3 +++ src/FileManipulator.php | 21 ++++++++++++++++++++- src/Media.php | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a77989492..c909b8456 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All Notable changes to `laravel-medialibrary` will be documented in this file +##3.3.1 +- Fixed a bug where conversions would always be performed on the default queue + ##3.3.0 - Added `hasCustomProperty`- and `getCustomProperty`-convenience-methods diff --git a/src/FileManipulator.php b/src/FileManipulator.php index 72897cf82..f0f99d709 100644 --- a/src/FileManipulator.php +++ b/src/FileManipulator.php @@ -39,7 +39,7 @@ public function createDerivedFiles(Media $media) $queuedConversions = $profileCollection->getQueuedConversions($media->collection_name); if (count($queuedConversions)) { - $this->dispatch(new PerformConversions($queuedConversions, $media)); + $this->dispatchQueuedConversions($media, $queuedConversions); } } @@ -128,4 +128,23 @@ protected function convertToImage($pdfFile) return $imageFile; } + + /** + * Dispatch the given conversions. + * + * @param Media $media + * @param $queuedConversions + */ + protected function dispatchQueuedConversions(Media $media, $queuedConversions) + { + $job = new PerformConversions($queuedConversions, $media); + + $customQueue = config('laravel-medialibrary.queue_name'); + + if ($customQueue != '') { + $job->onQueue($customQueue); + } + + $this->dispatch($job); + } } diff --git a/src/Media.php b/src/Media.php index e45c8caaa..c1925b317 100644 --- a/src/Media.php +++ b/src/Media.php @@ -108,7 +108,7 @@ public function getExtensionAttribute() } /** - /** + /** * @return string */ public function getHumanReadableSizeAttribute()