onQueue('v5-reconcile'); } public function handle(): void { $threshold = now()->addSeconds((int) config('flux.host_token_refresh_threshold')); V5Server::query() ->where('status', ServerStatus::Installed->value) ->where('has_coold', true) ->whereNotNull('last_bootstrapped_at') ->where(function ($query) use ($threshold): void { $query ->whereNull('agent_token_expires_at') ->orWhere('agent_token_expires_at', '<', $threshold); }) ->get() ->each(function (V5Server $server): void { try { V5RotateAgentTokenJob::dispatch($server->id); } catch (\Throwable $exception) { Log::warning('V5 token rotation dispatch failed for a server.', [ 'server_id' => $server->id, 'error' => $exception->getMessage(), ]); } }); } }