Skip to content

Commit

Permalink
tuning the migrate ops
Browse files Browse the repository at this point in the history
  • Loading branch information
haxjump committed Dec 9, 2024
1 parent 3d58031 commit ba4d7fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chaindev"
version = "0.52.7"
version = "0.52.8"
edition = "2021"
authors = ["hui.fan@mail.ru"]
description = "Powerful development and testing utils for blockchain developers."
Expand Down
21 changes: 10 additions & 11 deletions src/beacon_based/ddev/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,18 +766,16 @@ where
.fuhrers
.get(&new_node_id)
.or_else(|| self.meta.nodes.get(&new_node_id))
.cloned()
.c(d!("BUG"))?;

old_node
.migrate(new_node, self)
.c(d!())
.or_else(|_| {
self.kick_node(Some(new_node_id), true, force)
.c(d!())
.map(|_| ())
})
.and_then(|_| self.kick_node(Some(node_id), true, force).c(d!()))
.map(|_| new_node_id)
old_node.migrate(&new_node, self).c(d!()).or_else(|_| {
self.kick_node(Some(new_node_id), true, force)
.c(d!())
.map(|_| ())
})?; // .and_then(|_| self.kick_node(Some(node_id), true, force).c(d!()))

Ok(new_node_id)
}

// Kick out a target node, or a randomly selected one,
Expand Down Expand Up @@ -1835,7 +1833,7 @@ impl<P: NodePorts> Node<P> {

// Migrate this node to another host,
// NOTE: the node ID has been changed
fn migrate<C, S>(&self, new_node: &Node<P>, env: &Env<C, P, S>) -> Result<()>
fn migrate<C, S>(&self, new_node: &Node<P>, env: &mut Env<C, P, S>) -> Result<()>
where
C: CustomData,
S: NodeCmdGenerator<Node<P>, EnvMeta<C, Node<P>>>,
Expand All @@ -1848,6 +1846,7 @@ impl<P: NodePorts> Node<P> {
// only the validator client data need to be reserved,
// need to wait for the graceful exiting process ?
self.stop(env, false).c(d!())?;
env.update_online_status(&[], &[self.id]);

let migrate_fn = env
.node_cmdline_generator
Expand Down

0 comments on commit ba4d7fe

Please sign in to comment.