fix(queue): route cloud jobs to dedicated queues

Use config-based queue selection for deployment and scheduled jobs so cloud dispatches deployments to `deployments` and scheduled jobs to `crons`, while self-hosted keeps using `high`.

Add coverage for deployment queue helper, start action routing, and scheduled job manager routing.
This commit is contained in:
Andras Bacsai committed 2026-05-22 16:11:24 +02:00
1 parent 11dbcfcfe8
commit e2199f1223
8 files changed
+109 -20

No files matched your search

+1 -1
View File
@@ -197,7 +197,7 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
public function __construct(public int $application_deployment_queue_id)
{
$this->onQueue('high');
$this->onQueue(deployment_queue());
$this->application_deployment_queue = ApplicationDeploymentQueue::find($this->application_deployment_queue_id);
$this->nixpacks_plan_json = collect([]);
+7 -6
View File
@@ -40,14 +40,15 @@ class ScheduledJobManager implements ShouldQueue
$this->onQueue($this->determineQueue());
}
/**
* On cloud this job runs on a dedicated `crons` queue so it can be drained by an isolated
* Horizon worker pool; self-hosted keeps it on the shared `high` queue. Routing is decided
* by `isCloud()` (config-based), so the dispatching process needs no special env — only
* the worker must be configured to drain `crons` via `HORIZON_QUEUES`.
*/
private function determineQueue(): string
{
$preferredQueue = 'crons';
$fallbackQueue = 'high';
$configuredQueues = explode(',', env('HORIZON_QUEUES', 'high,default'));
return in_array($preferredQueue, $configuredQueues) ? $preferredQueue : $fallbackQueue;
return isCloud() ? 'crons' : 'high';
}
/**