Skip to content

Commit e0b601d

Browse files
committed
operator: improved error handling / logging
1 parent 4376334 commit e0b601d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tip-router-operator-cli/src/process_epoch.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,25 +112,25 @@ pub async fn loop_stages(
112112
save_stages: bool,
113113
) -> Result<()> {
114114
let keypair = read_keypair_file(&cli.keypair_path).expect("Failed to read keypair file");
115-
// This should attempt until it succeeds
115+
116116
let mut current_epoch_info = {
117117
loop {
118118
match rpc_client.get_epoch_info().await {
119119
Ok(info) => break info,
120120
Err(e) => {
121-
error!("Error getting epoch info. Retrying in 5 seconds...");
121+
error!("Error getting epoch info from RPC. Retrying...");
122122
tokio::time::sleep(Duration::from_secs(5)).await;
123123
}
124124
}
125125
}
126126
};
127-
// This should attempt until it succeeds
127+
128128
let epoch_schedule = {
129129
loop {
130130
match rpc_client.get_epoch_schedule().await {
131131
Ok(schedule) => break schedule,
132132
Err(e) => {
133-
error!("Error getting epoch schedule. Retrying in 5 seconds...");
133+
error!("Error getting epoch schedule from RPC. Retrying...");
134134
tokio::time::sleep(Duration::from_secs(5)).await;
135135
}
136136
}
@@ -311,7 +311,7 @@ pub async fn loop_stages(
311311
meta_merkle_tree_path(epoch_to_process, &cli.get_save_path());
312312

313313
let operator_address = Pubkey::from_str(&cli.operator_address)?;
314-
submit_to_ncn(
314+
let submit_result = submit_to_ncn(
315315
&rpc_client,
316316
&keypair,
317317
&operator_address,
@@ -327,7 +327,10 @@ pub async fn loop_stages(
327327
cli.vote_microlamports,
328328
&cli.cluster,
329329
)
330-
.await?;
330+
.await;
331+
if let Err(e) = submit_result {
332+
error!("Failed to submit epoch {} to NCN: {:?}", epoch_to_process, e);
333+
}
331334
stage = OperatorState::WaitForNextEpoch;
332335
}
333336
OperatorState::WaitForNextEpoch => {

0 commit comments

Comments
 (0)