This commit is contained in:
iVampireSP.com 2023-02-06 16:15:35 +08:00
parent 2832f93dcd
commit 39bc616d6c
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -42,7 +42,7 @@ public function handle(): void
try {
$response = $module->http()->get('remote');
} catch (Exception $e) {
Log::error('无法连接到模块 - down: '.$e->getMessage());
Log::debug('无法连接到模块 - down: ' . $e->getMessage());
// 如果模块状态不为 down则更新为 down
if ($module->status !== 'down') {
@ -57,7 +57,7 @@ public function handle(): void
// 如果模块状态不为 up则更新为 up
if ($module->status !== 'up') {
$module->status = 'up';
Log::error('模块状态更新为 up: '.$module->name);
Log::debug('模块状态更新为 up: ' . $module->name);
}
$json = $response->json();
@ -88,15 +88,17 @@ public function handle(): void
} else {
$module->status = 'down';
}
Log::debug('模块状态更新为 ' . $module->status . ': ' . $module->name);
}
$module->save();
// if local
if (config('app.env') === 'local') {
Cache::forever('module:'.$module->id.':servers', $servers);
Cache::forever('module:' . $module->id . ':servers', $servers);
} else {
Cache::put('module:'.$module->id.':servers', $servers, now()->addMinutes(10));
Cache::put('module:' . $module->id . ':servers', $servers, now()->addMinutes(10));
}
}
}