Skip to content

A self-hosted media server and file management system

fix: batches with no generated subtasks can never complete

aminnausin89fae5489334
diff --git a/app/Services/FileJobService.php b/app/Services/FileJobService.php
index 7cadd77b..8ed71b4f 100644
--- a/app/Services/FileJobService.php
+++ b/app/Services/FileJobService.php
@@ -351,6 +351,15 @@ class FileJobService {
$finalChain = is_callable($chain) ? $chain($task) : $chain;
$chainLength = count($finalChain);
+ if ($chainLength === 0) {
+ $this->taskService->updateTask($task->id, [
+ 'status' => TaskStatus::COMPLETED,
+ 'ended_at' => now(),
+ 'duration' => 0,
+ ]);
+ return $task;
+ }
+
$taskData = array_merge([
'sub_tasks_total' => $chainLength + $task->sub_tasks_total,
'sub_tasks_pending' => $chainLength,