改进
This commit is contained in:
parent
2832f93dcd
commit
39bc616d6c
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user