Skip to content

Commit

Permalink
Rename handle_nats_message to handle_nats_event
Browse files Browse the repository at this point in the history
Refactor function and logs to use 'event' terminology instead of 'message'. Updated Cargo.toml to version 0.9.1 to reflect these changes.
  • Loading branch information
arkavo-com committed Oct 20, 2024
1 parent 45da2d1 commit 6b524bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "arkavo-rs"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
rust-version = "1.80.0"

Expand Down
7 changes: 3 additions & 4 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ async fn handle_nats_subscription(
Ok(mut subscription) => {
info!("Subscribed to NATS subject: {}", subject);
while let Some(msg) = subscription.next().await {
if let Err(e) = handle_nats_message(msg, connection_state.clone()).await {
if let Err(e) = handle_nats_event(msg, connection_state.clone()).await {
error!("Error handling NATS message: {}", e);
}
}
Expand All @@ -808,20 +808,19 @@ async fn handle_nats_subscription(
tokio::time::sleep(NATS_RETRY_INTERVAL).await;
}
}
async fn handle_nats_message(
async fn handle_nats_event(
msg: NatsMessage,
connection_state: Arc<ConnectionState>,
) -> Result<(), Box<dyn std::error::Error>> {
let ws_message = Message::Binary(
vec![MessageType::Nats as u8]
vec![MessageType::Event as u8]
.into_iter()
.chain(msg.payload)
.collect(),
);
connection_state.outgoing_tx.send(ws_message)?;
Ok(())
}

async fn handle_event(server_state: &Arc<ServerState>, payload: &[u8], nats_connection: Arc<NatsConnection>,) -> Option<Message> {
let start_time = Instant::now();
let mut event_data: Option<Vec<u8>> = None;
Expand Down

0 comments on commit 6b524bb

Please sign in to comment.