改进 主机错误删除任务
This commit is contained in:
parent
86c0d3db5b
commit
b4482da0f0
@ -36,6 +36,13 @@ public function handle(): void
|
||||
// 查找不可用时间超过 3 天以上的 host
|
||||
(new Host)->where('status', 'unavailable')->where('unavailable_at', '<', now()->subDays(3))->delete();
|
||||
|
||||
// 查找错误状态超过 7 天以上的 host
|
||||
(new Host)->where('status', 'error')->where('updated_at', '<', now()->subDays(7))->chunk(100, function ($hosts) {
|
||||
foreach ($hosts as $host) {
|
||||
dispatch(new HostJob($host, 'delete'));
|
||||
}
|
||||
});
|
||||
|
||||
// 查找锁定时间超过 3 天以上的 host
|
||||
// (new Host)->where('status', 'locked')->where('locked_at', '<', now()->subDays(3))->chunk(100, function ($hosts) {
|
||||
// foreach ($hosts as $host) {
|
||||
|
Loading…
Reference in New Issue
Block a user