Skip to content

Commit

Permalink
validator: skip health check (#33568)
Browse files Browse the repository at this point in the history
* validator: skip health check

* keep `healthy` as a boolean
  • Loading branch information
diman-io authored Oct 8, 2023
1 parent bd8cfc9 commit 7afb11f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions validator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,11 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.long("skip-new-snapshot-check")
.help("Skip check for a new snapshot")
)
.arg(
Arg::with_name("skip_health_check")
.long("skip-health-check")
.help("Skip health check")
)
)
.subcommand(
SubCommand::with_name("authorized-voter")
Expand Down Expand Up @@ -1668,6 +1673,11 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.long("skip-new-snapshot-check")
.help("Skip check for a new snapshot")
)
.arg(
Arg::with_name("skip_health_check")
.long("skip-health-check")
.help("Skip health check")
)
.after_help("Note: If this command exits with a non-zero status \
then this not a good time for a restart")
).
Expand Down
7 changes: 6 additions & 1 deletion validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ fn wait_for_restart_window(
min_idle_time_in_minutes: usize,
max_delinquency_percentage: u8,
skip_new_snapshot_check: bool,
skip_health_check: bool,
) -> Result<(), Box<dyn std::error::Error>> {
let sleep_interval = Duration::from_secs(5);

Expand Down Expand Up @@ -161,7 +162,7 @@ fn wait_for_restart_window(
seen_incremential_snapshot |= snapshot_slot_info_has_incremential;

let epoch_info = rpc_client.get_epoch_info_with_commitment(CommitmentConfig::processed())?;
let healthy = rpc_client.get_health().ok().is_some();
let healthy = skip_health_check || rpc_client.get_health().ok().is_some();
let delinquent_stake_percentage = {
let vote_accounts = rpc_client.get_vote_accounts()?;
let current_stake: u64 = vote_accounts
Expand Down Expand Up @@ -649,6 +650,7 @@ pub fn main() {
let force = subcommand_matches.is_present("force");
let monitor = subcommand_matches.is_present("monitor");
let skip_new_snapshot_check = subcommand_matches.is_present("skip_new_snapshot_check");
let skip_health_check = subcommand_matches.is_present("skip_health_check");
let max_delinquent_stake =
value_t_or_exit!(subcommand_matches, "max_delinquent_stake", u8);

Expand All @@ -659,6 +661,7 @@ pub fn main() {
min_idle_time,
max_delinquent_stake,
skip_new_snapshot_check,
skip_health_check,
)
.unwrap_or_else(|err| {
println!("{err}");
Expand Down Expand Up @@ -777,13 +780,15 @@ pub fn main() {
let max_delinquent_stake =
value_t_or_exit!(subcommand_matches, "max_delinquent_stake", u8);
let skip_new_snapshot_check = subcommand_matches.is_present("skip_new_snapshot_check");
let skip_health_check = subcommand_matches.is_present("skip_health_check");

wait_for_restart_window(
&ledger_path,
identity,
min_idle_time,
max_delinquent_stake,
skip_new_snapshot_check,
skip_health_check,
)
.unwrap_or_else(|err| {
println!("{err}");
Expand Down

0 comments on commit 7afb11f

Please sign in to comment.