Skip to content

Commit

Permalink
fix loop hang
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Dec 2, 2024
1 parent 17f8903 commit fc809a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions crates/pubsub-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,14 @@ impl PubsubClient {
'manager: loop {
tokio::select! {
biased;
// Send close on shutdown signal
_ = (&mut shutdown_receiver) => {
log::info!("PubsubClient received shutdown");
let frame = CloseFrame { code: CloseCode::Normal, reason: "".into() };
ws.send(Message::Close(Some(frame))).await?;
ws.flush().await?;
break 'reconnect Ok(());
},
// Read incoming WebSocket message
next_msg = ws.next() => {
let msg = match next_msg {
Expand Down Expand Up @@ -487,14 +495,6 @@ impl PubsubClient {
continue 'manager;
}
}
// Send close on shutdown signal
_ = (&mut shutdown_receiver) => {
log::info!("PubsubClient received shutdown");
let frame = CloseFrame { code: CloseCode::Normal, reason: "".into() };
ws.send(Message::Close(Some(frame))).await?;
ws.flush().await?;
break 'reconnect Ok(());
},
// Read message for subscribe
Some((operation, params, response_sender)) = subscribe_receiver.recv() => {
request_id += 1;
Expand Down
6 changes: 4 additions & 2 deletions crates/src/drift_idl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![doc = r""]
#![doc = r" Auto-generated IDL types, manual edits do not persist (see `crates/drift-idl-gen`)"]
#![doc = r""]
use self::traits::ToAccountMetas;
use anchor_lang::{
prelude::{
account,
Expand All @@ -13,6 +12,8 @@ use anchor_lang::{
};
use serde::{Deserialize, Serialize};
use solana_sdk::{instruction::AccountMeta, pubkey::Pubkey};

use self::traits::ToAccountMetas;
pub mod traits {
use solana_sdk::instruction::AccountMeta;
#[doc = r" This is distinct from the anchor_lang version of the trait"]
Expand Down Expand Up @@ -1918,8 +1919,9 @@ pub mod instructions {
}
pub mod types {
#![doc = r" IDL types"]
use super::*;
use std::ops::Mul;

use super::*;
#[doc = ""]
#[doc = " backwards compatible u128 deserializing data from rust <=1.76.0 when u/i128 was 8-byte aligned"]
#[doc = " https://solana.stackexchange.com/questions/7720/using-u128-without-sacrificing-alignment-8"]
Expand Down

0 comments on commit fc809a5

Please sign in to comment.