diff --git a/app/Jobs/DeleteHost.php b/app/Jobs/DeleteHost.php index 4f68f8c..192f7ad 100644 --- a/app/Jobs/DeleteHost.php +++ b/app/Jobs/DeleteHost.php @@ -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')); + } + }); } }