重命名
This commit is contained in:
parent
c146cbce21
commit
e57a03824b
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\Host\DeleteHostJob;
|
||||
use App\Jobs\Host\DeleteSuspendedHostJob;
|
||||
use App\Jobs\Host\DispatchHostCostQueueJob;
|
||||
use App\Jobs\Host\ScanAllHostsJob;
|
||||
use App\Jobs\Module\FetchModuleJob;
|
||||
@ -45,7 +45,7 @@ protected function schedule(Schedule $schedule): void
|
||||
$schedule->job(new ClearTasksJob())->weekly();
|
||||
|
||||
// 删除暂停或部署时间超过 3 天以上的主机
|
||||
$schedule->job(new DeleteHostJob())->hourly();
|
||||
$schedule->job(new DeleteSuspendedHostJob())->hourly();
|
||||
|
||||
// 检查主机是否存在于模块
|
||||
$schedule->job(new ScanAllHostsJob())->everyThirtyMinutes()->withoutOverlapping()->onOneServer();
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
|
||||
class DeleteHostJob implements ShouldQueue
|
||||
class DeleteSuspendedHostJob implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
@ -11,7 +11,7 @@
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateOrDeleteHostJob implements ShouldQueue
|
||||
class UpdateOrSuspendedHostJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
@ -41,7 +41,7 @@ public function handle(): void
|
||||
if ($response['status'] === 200) {
|
||||
$host->update(Arr::except($response['json'], ['id', 'user_id', 'module_id', 'created_at', 'updated_at']));
|
||||
} else if ($response['status'] === 404) {
|
||||
Log::warning($host->module->name . ' ' . $host->name . ' ' . $host->id . ' 不存在,删除。');
|
||||
Log::warning($host->module->name . ' ' . $host->name . ' ' . $host->id . ' 不存在,标记为暂停。');
|
||||
dispatch(new HostJob($host, 'delete'));
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
|
||||
use App\Events\Users;
|
||||
use App\Jobs\Host\HostJob;
|
||||
use App\Jobs\Host\UpdateOrDeleteHostJob;
|
||||
use App\Jobs\Host\UpdateOrSuspendedHostJob;
|
||||
use App\Notifications\WebNotification;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
@ -307,7 +307,7 @@ public function addLog(string $amount = "0"): bool
|
||||
|
||||
public function updateOrDelete(): bool
|
||||
{
|
||||
dispatch(new UpdateOrDeleteHostJob($this));
|
||||
dispatch(new UpdateOrSuspendedHostJob($this));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user