改进 扫描全部主机

This commit is contained in:
iVampireSP.com 2023-01-19 02:35:13 +08:00
parent 8b2982f385
commit 6849d551e6
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -32,8 +32,8 @@ public function __construct()
*/
public function handle(): void
{
// 删除所有模块中不存在的主机
Host::with('module')->where('created_at', '<', now()->subHour())->chunk(100, function ($hosts) {
// 扫描全部主机
Host::with('module')->chunk(100, function ($hosts) {
foreach ($hosts as $host) {
// 忽略维护中的模块
if ($host->module->status !== 'up') {
@ -41,7 +41,6 @@ public function handle(): void
}
$host->updateOrDelete();
}
});
}