This commit is contained in:
2026-04-18 12:07:16 +02:00
parent 0e8c7ac403
commit ee6c4c3e91
2 changed files with 7 additions and 4 deletions

View File

@@ -37,9 +37,7 @@ pub async fn run_listener_runtime(
};
let ws_client_config =
crate::KhbbSolanaWsRpcClientConfig { url: config.solana_ws_rpc_url.clone() };
let ws_client_result = crate::KhbbSolanaWsRpcClient::new(ws_client_config);
let mut ws_client = match ws_client_result {
Ok(value) => value,
Err(error) => {
@@ -111,6 +109,7 @@ pub async fn run_listener_runtime(
subscription_id = slot_subscription_handle.subscription_id,
"slot websocket subscription established"
);
let mut final_status = std::string::String::from("stopped");
loop {
tokio::select! {
_ = interval.tick() => {
@@ -197,6 +196,8 @@ pub async fn run_listener_runtime(
listener_session_id = session.id,
"websocket stream ended"
);
final_status = std::string::String::from("ws_stream_ended");
break;
}
Err(error) => {
tracing::error!(
@@ -204,6 +205,8 @@ pub async fn run_listener_runtime(
error = %error,
"failed to read websocket message"
);
final_status = std::string::String::from("ws_read_error");
break;
}
}
}
@@ -286,7 +289,7 @@ pub async fn run_listener_runtime(
},
}
let status_update_result =
crate::storage::update_listener_session_status(pool, session.id, "stopped").await;
crate::storage::update_listener_session_status(pool, session.id, &final_status).await;
match status_update_result {
Ok(()) => {
tracing::info!(listener_session_id = session.id, "listener runtime stopped");