改进 同时 刷新节点信息
This commit is contained in:
parent
4f5acc3a04
commit
9dfe045514
@ -36,6 +36,8 @@ public static function publish($event, $data = []): void
|
|||||||
],
|
],
|
||||||
'data' => $data,
|
'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);
|
return Redis::hget($key, $value, $default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function registerThisNode(): void
|
public static function registerThisNode($report = true): void
|
||||||
{
|
{
|
||||||
$node_id = config('settings.node.id');
|
$node_id = config('settings.node.id');
|
||||||
|
|
||||||
@ -112,6 +114,8 @@ public static function registerThisNode(): void
|
|||||||
'last_heartbeat' => time(),
|
'last_heartbeat' => time(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Cluster::publish('node.ok');
|
if ($report) {
|
||||||
|
Cluster::publish('node.ok');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user