Skip to content

Commit

Permalink
Unified queue job ordering across all db engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-MyAnaPro authored and romanzipp committed May 2, 2024
1 parent 86cb0e4 commit 0082a50
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Controllers/ShowQueueMonitorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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`');
}
Expand All @@ -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
Expand Down

0 comments on commit 0082a50

Please sign in to comment.