From 0082a50c85d80d2fe467bbc4406c70ea7b71bc89 Mon Sep 17 00:00:00 2001 From: Tristan Date: Sun, 28 Apr 2024 18:22:59 +0200 Subject: [PATCH] Unified queue job ordering across all db engine --- src/Controllers/ShowQueueMonitorController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Controllers/ShowQueueMonitorController.php b/src/Controllers/ShowQueueMonitorController.php index 57e3c42..4c4a071 100644 --- a/src/Controllers/ShowQueueMonitorController.php +++ b/src/Controllers/ShowQueueMonitorController.php @@ -54,9 +54,8 @@ public function __invoke(Request $request) $jobsQuery->where('data', 'like', "%{$filters['custom_data']}%"); } + $connection = DB::connection(); if (config('queue-monitor.ui.order_queued_first')) { - $connection = DB::connection(); - if ($connection instanceof DatabaseConnections\MySqlConnection) { $jobsQuery->orderByRaw('-`started_at`'); } @@ -68,6 +67,8 @@ public function __invoke(Request $request) if ($connection instanceof DatabaseConnections\SQLiteConnection) { $jobsQuery->orderByRaw('started_at DESC NULLS FIRST'); } + } elseif ($connection instanceof DatabaseConnections\PostgresConnection) { + $jobsQuery->orderByRaw('started_at DESC NULLS LAST'); } $jobsQuery