Add mechanism to determine when a node has finished booting

This commit is contained in:
Michael Vines
2019-01-22 11:34:12 -08:00
committed by Grimes
parent f630b50902
commit cc88f9bcd6
3 changed files with 59 additions and 31 deletions

View File

@@ -180,6 +180,13 @@ fn main() {
.takes_value(true)
.help("RPC port to use for this node"),
)
.arg(
Arg::with_name("init_complete_file")
.long("init-complete-file")
.value_name("FILE")
.takes_value(true)
.help("Create this file, if it doesn't already exist, once node initialization is complete"),
)
.get_matches();
let no_sigverify = matches.is_present("nosigverify");
@@ -210,6 +217,7 @@ fn main() {
solana_netutil::find_available_port_in_range(FULLNODE_PORT_RANGE)
.expect("unable to allocate rpc port")
};
let init_complete_file = matches.value_of("init_complete_file");
let keypair = Arc::new(keypair);
let node = Node::new_with_external_ip(keypair.pubkey(), &gossip);
@@ -258,6 +266,10 @@ fn main() {
}
}
if let Some(filename) = init_complete_file {
File::create(filename).unwrap_or_else(|_| panic!("Unable to create: {}", filename));
}
info!("Node initialized");
loop {
let status = fullnode.handle_role_transition();
match status {