where('created_at', '<', now()->subHour())->chunk(100, function ($hosts) { foreach ($hosts as $host) { // 忽略维护中的模块 if ($host->module->status !== 'up') { continue; } $response = $host->module->http()->get('hosts/' . $host->id); if ($response->status() === 404) { Log::warning($host->module->name . ' ' . $host->name . ' ' . $host->id . ' 不存在,删除。'); dispatch(new Module\HostJob($host, 'delete')); } } }); } }