Skip to content

Commit

Permalink
Reconnecting instead of panicing for some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
godmodegalactus committed Jan 7, 2024
1 parent 4d7e781 commit 6a89fff
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/grpc_subscription_autoreconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ fn map_commitment_level(commitment_config: CommitmentConfig) -> CommitmentLevel
yellowstone_grpc_proto::prelude::CommitmentLevel::Finalized
}
_ => {
panic!(
"unsupported commitment level {}",
log::error!(
"unsupported commitment level {}, defaulting to finalized",
commitment_config.commitment
)
);
yellowstone_grpc_proto::prelude::CommitmentLevel::Finalized
}
}
}
Expand Down Expand Up @@ -214,7 +215,8 @@ pub fn create_geyser_reconnecting_stream(
(ConnectionState::WaitReconnect(attempt), Message::Connecting(attempt))
},
Err(geyser_grpc_task_error) => {
panic!("! task aborted - should not happen :{geyser_grpc_task_error}");
warn!("task aborted reconnect error: {}", geyser_grpc_task_error);
(ConnectionState::WaitReconnect(attempt), Message::Connecting(attempt))
}
}

Expand All @@ -234,7 +236,9 @@ pub fn create_geyser_reconnecting_stream(
}
None => {
// should not arrive here, Mean the stream close.
panic!("geyser stream closed on {} - retrying", grpc_source);
// reconnect
warn!("task aborted reconnect");
(ConnectionState::WaitReconnect(attempt), Message::Connecting(attempt))
}
}

Expand Down

0 comments on commit 6a89fff

Please sign in to comment.