改进 删除
This commit is contained in:
parent
327006e337
commit
e2ead8de63
@ -34,17 +34,13 @@ public function handle(): void
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 查找不可用时间超过 3 天以上的 host
|
// 查找不可用时间超过 3 天以上的 host
|
||||||
(new Host)->where('status', 'unavailable')->where('unavailable_at', '<', now()->subDays(3))->chunk(100, function ($hosts) {
|
(new Host)->where('status', 'unavailable')->where('unavailable_at', '<', now()->subDays(3))->delete();
|
||||||
foreach ($hosts as $host) {
|
|
||||||
dispatch(new HostJob($host, 'delete', false));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 查找锁定时间超过 3 天以上的 host
|
// 查找锁定时间超过 3 天以上的 host
|
||||||
(new Host)->where('status', 'locked')->where('locked_at', '<', now()->subDays(3))->chunk(100, function ($hosts) {
|
// (new Host)->where('status', 'locked')->where('locked_at', '<', now()->subDays(3))->chunk(100, function ($hosts) {
|
||||||
foreach ($hosts as $host) {
|
// foreach ($hosts as $host) {
|
||||||
dispatch(new HostJob($host, 'delete'));
|
// dispatch(new HostJob($host, 'delete'));
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user