Skip to content

A self-hosted media server and file management system

fix: storyboard specific queue does not work, must enforce explicitly on batch

aminnausin3a63c5f62aa2
diff --git a/app/Jobs/Metadata/GenerateStoryboard.php b/app/Jobs/Metadata/GenerateStoryboard.php
index eb576dfe..9a8548b5 100644
--- a/app/Jobs/Metadata/GenerateStoryboard.php
+++ b/app/Jobs/Metadata/GenerateStoryboard.php
@@ -39,7 +39,6 @@ class GenerateStoryboard extends ManagedSubTask {
public function __construct(string $filePath, string $uuid, int $taskId) {
$this->filePath = $filePath;
$this->uuid = $uuid;
- $this->queue = config('queue.default') === 'redis' ? 'encode' : 'default';
$subTask = SubTask::create([
'task_id' => $taskId,
diff --git a/app/Services/FileJobService.php b/app/Services/FileJobService.php
index a775a920..e1cb20a0 100644
--- a/app/Services/FileJobService.php
+++ b/app/Services/FileJobService.php
@@ -239,6 +239,7 @@ class FileJobService {
return $chain;
},
+ queue: 'encode'
);
}
@@ -305,6 +306,7 @@ class FileJobService {
return $chain;
},
+ queue: 'encode'
);
}
@@ -325,6 +327,7 @@ class FileJobService {
),
];
},
+ queue: 'encode'
);
}
@@ -336,6 +339,7 @@ class FileJobService {
?callable $callback = null,
array $initialTaskData = [],
?int $initialTaskId = null,
+ ?string $queue = 'default',
) {
$task = $initialTaskId ? Task::findOrFail($initialTaskId) : $this->setupTask($userId, $name, $description);
@@ -353,7 +357,8 @@ class FileJobService {
$finalChain,
$task,
$callback,
- $taskData
+ $taskData,
+ $queue
);
return $task;
@@ -373,7 +378,7 @@ class FileJobService {
]);
}
- public function setupBatch(array $chain, Task $task, ?callable $callback = null, ?array $taskData = []) {
+ public function setupBatch(array $chain, Task $task, ?callable $callback, ?array $taskData, string $queue) {
return Bus::batch($chain)
->catch(fn (Batch $batch, \Throwable $e) => $this->handleOperationFailure($task, $e))
->finally(fn (Batch $batch) => $this->finalizeBatch($batch, $task, $callback))
@@ -381,6 +386,7 @@ class FileJobService {
'batch_id' => $batch->id,
], $taskData)))
->name($task->name)
+ ->onQueue($queue)
->dispatch();
}
diff --git a/package.json b/package.json
index d055f97c..fbb64871 100755
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"php:serve": "php artisan serve",
"php:pail": "php artisan pail",
"php:test": "php artisan test",
- "php:queue": "php artisan queue:listen --timeout=3600",
+ "php:queue": "php artisan queue:listen --queue=default,encode --timeout=3600",
"php:queue-high": "php artisan queue:listen --queue=high",
"php:pulse": "php artisan pulse:check",
"php:scheduler": "php artisan schedule:work",