改进 同时 刷新节点信息

This commit is contained in:
iVampireSP.com 2023-01-05 02:06:51 +08:00
parent 4f5acc3a04
commit 9dfe045514
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -36,6 +36,8 @@ public static function publish($event, $data = []): void
],
'data' => $data,
]));
self::registerThisNode();
}
/**
@ -100,7 +102,7 @@ public static function hget($key, $value, $default = null): string|array|null
return Redis::hget($key, $value, $default);
}
public static function registerThisNode(): void
public static function registerThisNode($report = true): void
{
$node_id = config('settings.node.id');
@ -112,6 +114,8 @@ public static function registerThisNode(): void
'last_heartbeat' => time(),
]);
if ($report) {
Cluster::publish('node.ok');
}
}
}