A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
catch broadcasting errors
aminnausinfe6c3cb49020
diff --git a/app/Events/SubTaskUpdated.php b/app/Events/SubTaskUpdated.phpindex e4d9b6ba..d8b30408 100644--- a/app/Events/SubTaskUpdated.php+++ b/app/Events/SubTaskUpdated.php@@ -34,7 +34,6 @@ class SubTaskUpdated implements ShouldBroadcast {*/public function broadcastOn(): array {try {- // code...return [new PrivateChannel("tasks.{$this->subTask->task_id}.subtasks"),];diff --git a/app/Events/TaskEnded.php b/app/Events/TaskEnded.phpindex 2919359b..24038ba9 100644--- a/app/Events/TaskEnded.php+++ b/app/Events/TaskEnded.php@@ -11,7 +11,9 @@ use Illuminate\Contracts\Broadcasting\ShouldBroadcast;// use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;use Illuminate\Foundation\Events\Dispatchable;use Illuminate\Queue\SerializesModels;+use Illuminate\Support\Facades\Log;+// This notifys the person who initiated the task that it is finished.class TaskEnded implements ShouldBroadcast {use Dispatchable, InteractsWithSockets, SerializesModels;@@ -36,13 +38,13 @@ class TaskEnded implements ShouldBroadcast {*/public function broadcastOn(): array {try {- // code...return [new PrivateChannel("tasks.{$this->task->id}"),- // new PrivateChannel('dashboard.tasks'),];} catch (\Throwable $th) {dump($th->getMessage());+ Log::error('Unable to broadcast task ended update', ['error' => $th->getMessage()]);+ throw $th;}}@@ -50,6 +52,12 @@ class TaskEnded implements ShouldBroadcast {* Get the data to broadcast.*/public function broadcastWith(): array {- return ['task' => new TasksResource($this->task)];+ try {+ return ['task' => new TasksResource($this->task)];+ } catch (\Throwable $th) {+ dump($th->getMessage());+ Log::error('Unable to broadcast task ended update', ['error' => $th->getMessage()]);+ throw $th;+ }}}diff --git a/app/Services/TaskService.php b/app/Services/TaskService.phpindex db9d3dfa..00e473a8 100644--- a/app/Services/TaskService.php+++ b/app/Services/TaskService.php@@ -6,19 +6,24 @@ use App\Events\SubTaskUpdated;use App\Events\TaskUpdated;use App\Models\SubTask;use App\Models\Task;+use Illuminate\Support\Facades\Log;class TaskService {public function createTask(array $attrs): Task {$task = Task::create($attrs);- broadcast(new TaskUpdated($task));++ try {+ broadcast(new TaskUpdated($task));+ } catch (\Throwable $th) {+ dump($th->getMessage());+ Log::error('Unable to broadcast task creation', ['error' => $th->getMessage()]);+ }return $task;}public function createSubTask(array $attrs): SubTask {$subTask = SubTask::create($attrs);- // broadcast(new SubTaskUpdated($subTask));-return $subTask;}@@ -37,7 +42,12 @@ class TaskService {}$task->save();- broadcast(new TaskUpdated($task));+ try {+ broadcast(new TaskUpdated($task));+ } catch (\Throwable $th) {+ dump($th->getMessage());+ Log::error('Unable to broadcast task update', ['error' => $th->getMessage()]);+ }return $task;}@@ -57,7 +67,12 @@ class TaskService {}$subTask->save();if ($broadcast) {- broadcast(new SubTaskUpdated($subTask));+ try {+ broadcast(new SubTaskUpdated($subTask));+ } catch (\Throwable $th) {+ dump($th->getMessage());+ Log::error('Unable to broadcast subTask update', ['error' => $th->getMessage()]);+ }}return $subTask;@@ -81,7 +96,12 @@ class TaskService {}$task->save();if ($broadcast) {- broadcast(new TaskUpdated($task));+ try {+ broadcast(new TaskUpdated($task));+ } catch (\Throwable $th) {+ dump($th->getMessage());+ Log::error('Unable to broadcast task count update', ['error' => $th->getMessage()]);+ }}return $task;diff --git a/routes/web.php b/routes/web.phpindex a328ba26..e47bda92 100755--- a/routes/web.php+++ b/routes/web.php@@ -48,11 +48,11 @@ Route::get('/signed-url/{path}', function ($path) {);})->middleware('auth')->where('path', '.*');-Route::get('/broadcast', function () {- $task = Task::first();- dump($task);- broadcast(new TaskEnded($task));-});+// Route::get('/broadcast', function () {+// $task = Task::first();+// dump($task);+// broadcast(new TaskEnded($task));+// });Route::middleware(['web'])->group(function () {Route::get('/pulse', function () {