增加 删除一直在 pending 的主机

This commit is contained in:
Database Server 2022-11-08 09:44:06 +08:00
parent aa80c6d6d2
commit 852dbcb50e

View File

@ -39,5 +39,12 @@ public function handle()
dispatch(new \App\Jobs\Remote\Host($host, 'delete'));
}
});
// 查找部署时间超过3天以上的 host
Host::where('status', 'pending')->where('created_at', '<', now()->subDays(3))->chunk(100, function ($hosts) {
foreach ($hosts as $host) {
dispatch(new \App\Jobs\Remote\Host($host, 'delete'));
}
});
}
}