Skip to content

Commit

Permalink
geyser: optimize consuming of new filters (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid authored Oct 10, 2024
1 parent c90638f commit 8a9fca6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The minor version will be incremented upon a breaking change and the patch versi
### Features

- proto: use `gzip`/`zstd` features by default ([#436](https://github.com/rpcpool/yellowstone-grpc/pull/436))
- geyser: optimize consuming of new filters ([#439](https://github.com/rpcpool/yellowstone-grpc/pull/439))

### Breaking

Expand Down
16 changes: 15 additions & 1 deletion yellowstone-grpc-geyser/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,21 @@ impl GrpcService {
if is_alive {
'outer: loop {
tokio::select! {
message = client_rx.recv() => {
mut message = client_rx.recv() => {
// forward to latest filter
loop {
match client_rx.try_recv() {
Ok(message_new) => {
message = Some(message_new);
}
Err(mpsc::error::TryRecvError::Empty) => break,
Err(mpsc::error::TryRecvError::Disconnected) => {
message = None;
break;
}
}
}

match message {
Some(Some(filter_new)) => {
if let Some(msg) = filter_new.get_pong_msg() {
Expand Down

0 comments on commit 8a9fca6

Please sign in to comment.