where('created_at', '<', now()->subHour())->chunk(100, function ($hosts) { foreach ($hosts as $host) { $http = Http::module($host->module->api_token, $host->module->url); $response = $http->get('hosts/' . $host->id); if ($response->status() === 404) { Log::warning($host->module->name . ' ' . $host->name . ' ' . $host->id . ' 不存在,删除。'); dispatch(new \App\Jobs\Module\Host($host, 'delete')); } } }); } }