mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
fix the leader election
This commit is contained in:
parent
8e437ed76c
commit
8c20d6e2fe
@ -596,7 +596,8 @@ impl IndexScheduler {
|
|||||||
let (_stat, id) = zk.create("/election/node-", &[], &options).await.unwrap();
|
let (_stat, id) = zk.create("/election/node-", &[], &options).await.unwrap();
|
||||||
self_node_id = id;
|
self_node_id = id;
|
||||||
let previous_path = {
|
let previous_path = {
|
||||||
let list = zk.list_children("/election").await.unwrap();
|
let mut list = zk.list_children("/election").await.unwrap();
|
||||||
|
list.sort();
|
||||||
|
|
||||||
let self_node_path = format!("node-{}", self_node_id);
|
let self_node_path = format!("node-{}", self_node_id);
|
||||||
let previous_path =
|
let previous_path =
|
||||||
@ -629,7 +630,8 @@ impl IndexScheduler {
|
|||||||
zk::EventType::NodeDeleted => {
|
zk::EventType::NodeDeleted => {
|
||||||
let zk = zk.as_ref().unwrap();
|
let zk = zk.as_ref().unwrap();
|
||||||
let previous_path = {
|
let previous_path = {
|
||||||
let list = zk.list_children("/election").await.unwrap();
|
let mut list = zk.list_children("/election").await.unwrap();
|
||||||
|
list.sort();
|
||||||
|
|
||||||
let self_node_path = format!("node-{}", self_node_id);
|
let self_node_path = format!("node-{}", self_node_id);
|
||||||
let previous_path =
|
let previous_path =
|
||||||
|
Loading…
Reference in New Issue
Block a user