0.3.15-pre.015
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-onchain-transport-lib/src/grpc_stream.rs
|
||||
// version: 5
|
||||
// version: 6
|
||||
|
||||
use tonic_prost::prost::Message; // rust-rules: trait-import
|
||||
|
||||
@@ -296,8 +296,9 @@ impl SolanaYellowstoneGrpcSubscribeSession {
|
||||
|
||||
/// Receives the next decoded standard Yellowstone update.
|
||||
///
|
||||
/// Transient remote stream loss is hidden while KSP performs a bounded reconnect. Terminal remote statuses after the reconnect budget, malformed updates
|
||||
/// and overflow surface a safe KSP error. A normal close returns `Ok(None)`.
|
||||
/// Transient remote stream loss is hidden while KSP performs a bounded reconnect. A full bounded update queue applies asynchronous backpressure to the
|
||||
/// gRPC stream instead of dropping an update or terminating locally; terminal remote statuses after the reconnect budget and malformed updates still
|
||||
/// surface a safe KSP error. A normal close returns `Ok(None)`.
|
||||
pub async fn next_update(&mut self) -> ksp_core_lib::Result<std::option::Option<crate::YellowstoneSubscribeUpdate>> {
|
||||
return match self.update_rx.recv().await {
|
||||
std::option::Option::Some(std::result::Result::Ok(update)) => std::result::Result::Ok(std::option::Option::Some(update)),
|
||||
@@ -635,23 +636,30 @@ async fn run_subscribe_actor(
|
||||
}
|
||||
tracker.observe(&update, &mut snapshot);
|
||||
snapshot_tx.send_replace(snapshot);
|
||||
match update_tx.try_send(std::result::Result::Ok(update)) {
|
||||
std::result::Result::Ok(()) => {},
|
||||
std::result::Result::Err(tokio::sync::mpsc::error::TrySendError::Full(_)) => {
|
||||
ksp_logging_lib::warn!(
|
||||
target: crate::TRACING_TARGET,
|
||||
endpoint_name = endpoint_name.as_str(),
|
||||
provider = provider.as_str(),
|
||||
cluster = cluster.as_str(),
|
||||
"Yellowstone subscribe update queue overflowed"
|
||||
);
|
||||
fail_actor(crate::ERROR_CODE_GRPC_BACKPRESSURE_OVERFLOW, &request_state, &mut snapshot, &snapshot_tx);
|
||||
let delivery = tokio::select! {
|
||||
biased;
|
||||
shutdown_changed = shutdown_rx.changed() => {
|
||||
let deadline = shutdown_deadline(&shutdown_rx, shutdown_changed);
|
||||
snapshot.state = crate::YellowstoneGrpcSubscribeState::Closing;
|
||||
snapshot_tx.send_replace(snapshot);
|
||||
clear_request_sender(&request_state);
|
||||
finish_client_half_close(
|
||||
&endpoint_name,
|
||||
&provider,
|
||||
&cluster,
|
||||
&mut incoming,
|
||||
deadline,
|
||||
&mut snapshot,
|
||||
&snapshot_tx,
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
},
|
||||
std::result::Result::Err(tokio::sync::mpsc::error::TrySendError::Closed(_)) => {
|
||||
close_actor(&request_state, &mut snapshot, &snapshot_tx);
|
||||
return;
|
||||
},
|
||||
}
|
||||
result = update_tx.send(std::result::Result::Ok(update)) => result,
|
||||
};
|
||||
if delivery.is_err() {
|
||||
close_actor(&request_state, &mut snapshot, &snapshot_tx);
|
||||
return;
|
||||
}
|
||||
},
|
||||
std::result::Result::Ok(std::option::Option::None) => {
|
||||
|
||||
Reference in New Issue
Block a user