Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo committed Jan 8, 2025
1 parent d972580 commit 6b00e49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pubsub-client/src/nonblocking/pubsub_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
//! # Ok::<(), anyhow::Error>(())
//! ```
use crate::nonblocking::pubsub_client::{DEFAULT_MAX_FAILED_PINGS, DEFAULT_PING_DURATION_SECONDS};
use {
futures_util::{
future::{ready, BoxFuture, FutureExt},
Expand Down Expand Up @@ -197,7 +198,7 @@ use {
net::TcpStream,
sync::{mpsc, oneshot},
task::JoinHandle,
time::{interval, Interval, Duration},
time::{interval, Duration, Interval},
},
tokio_stream::wrappers::UnboundedReceiverStream,
tokio_tungstenite::{
Expand All @@ -210,7 +211,6 @@ use {
},
url::Url,
};
use crate::nonblocking::pubsub_client::{DEFAULT_PING_DURATION_SECONDS, DEFAULT_MAX_FAILED_PINGS};

pub type PubsubClientResult<T = ()> = Result<T, PubsubClientError>;

Expand Down Expand Up @@ -511,7 +511,8 @@ impl PubsubClient {
let mut subscriptions = BTreeMap::new();
let (unsubscribe_sender, mut unsubscribe_receiver) = mpsc::unbounded_channel();

let mut ping_interval: Interval = interval(Duration::from_secs(DEFAULT_PING_DURATION_SECONDS));
let mut ping_interval: Interval =
interval(Duration::from_secs(DEFAULT_PING_DURATION_SECONDS));
let mut elapsed_pings: usize = 0usize;

loop {
Expand Down
6 changes: 3 additions & 3 deletions pubsub-client/src/pubsub_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ where
if message.is_ping() || message.is_pong() {
return Ok(None);
}

let message_text = &message.into_text()?;
if let Ok(json_msg) = serde_json::from_str::<Map<String, Value>>(message_text) {
if let Some(Object(params)) = json_msg.get("params") {
Expand All @@ -232,7 +232,7 @@ where
}
}
}

Err(PubsubClientError::UnexpectedMessageError(format!(
"msg={message_text}"
)))
Expand Down Expand Up @@ -836,7 +836,7 @@ impl PubsubClient {
break;
}
}

// Read timeout to prevent indefinite blocking on `read_message`
socket
.write()
Expand Down

0 comments on commit 6b00e49

Please sign in to comment.