使用 状态判断
This commit is contained in:
parent
ac6112ac20
commit
adc461a580
@ -51,7 +51,7 @@ public function destroy(HostRequest $request, Host $host): JsonResponse
|
||||
{
|
||||
unset($request);
|
||||
|
||||
if ($host->status == 'pending') {
|
||||
if ($host->isPending()) {
|
||||
// 如果上次更新时间大于 5min
|
||||
if ($host->updated_at->diffInMinutes(now()) > 5) {
|
||||
$host->delete();
|
||||
|
@ -49,13 +49,13 @@ public function handle(): void
|
||||
$host = $this->host;
|
||||
|
||||
// 忽略 unavailable 状态的 host
|
||||
if ($this->pass_unavailable && $host->status === 'unavailable') {
|
||||
if ($this->pass_unavailable && $host->isUnavailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$host->load(['module']);
|
||||
|
||||
if ($host->module->status !== 'up') {
|
||||
if (!$host->module->isUp()) {
|
||||
Log::warning('模块不可用,跳过主机更新。', [
|
||||
'host' => $host->name,
|
||||
'module' => $host->module->name,
|
||||
|
Loading…
Reference in New Issue
Block a user