Files
coolify/app/Jobs/ServerFilesFromServerJob.php
T
Andras Bacsai 3b33e8a4ab fix(domains): stop the DNS poll from flooding the high queue
The Domains page polls every 2 seconds while a DNS check runs. Each poll
parsed the compose file, and the parser queued one ServerFilesFromServerJob
per volume. The jobs starved the DNS check jobs and deployments.

- Skip the compose parse in pollDnsChecks and keep the known services.
- Make ServerFilesFromServerJob unique per resource until it runs.

Fixes #12098
2026-10-08 13:43:45 +02:00

41 lines
1.2 KiB
PHP

<?php
namespace App\Jobs;
use App\Models\Application;
use App\Models\ServiceApplication;
use App\Models\ServiceDatabase;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ServerFilesFromServerJob implements ShouldBeEncrypted, ShouldBeUniqueUntilProcessing, ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Only one sync per resource can wait in the queue. The compose parser dispatches
* this job once per volume on every parse, so without this the queue fills with copies.
*/
public int $uniqueFor = 600;
public function __construct(public ServiceApplication|ServiceDatabase|Application $resource)
{
$this->onQueue('high');
}
public function uniqueId(): string
{
return $this->resource::class.':'.$this->resource->id;
}
public function handle()
{
$this->resource->getFilesFromServer(isInit: true);
}
}