Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonblocking slot_subscribe stuck #35506

Closed
yipu3 opened this issue Apr 9, 2024 · 1 comment
Closed

Nonblocking slot_subscribe stuck #35506

yipu3 opened this issue Apr 9, 2024 · 1 comment
Labels
community Community contribution

Comments

@yipu3
Copy link

yipu3 commented Apr 9, 2024

Problem

I wrote a demo program to subscribe to on-chain slot events. But the program stuck and did not receive any events from the websocket RPC (from Alchemy).

The library I use is solana_client::nonblocking::pubsub_client::PubsubClient.

use futures_util::StreamExt;
use solana_client::nonblocking::pubsub_client::PubsubClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let ps_client = PubsubClient::new(
        &"wss://solana-mainnet.g.alchemy.com/v2/xxx".to_string(),
    )
    .await?;

    let (mut accounts, unsubscriber) = ps_client.slot_subscribe().await?;

    let mut count = 0;
    println!("{}", 1);
    while let Some(response) = accounts.next().await {
        println!("{:?}", response);
        count += 1;
        if count >= 5 {
            break;
        }
    }
    println!("{}", 2);

    unsubscriber().await;

    Ok(())
}

Is that because of the way I use the nonblocking lib?

Proposed Solution

None

@yipu3 yipu3 added the community Community contribution label Apr 9, 2024
Copy link
Contributor

github-actions bot commented Apr 9, 2024

This repository is no longer in use. Please re-open this issue in the agave repo: https://github.com/anza-xyz/agave

@github-actions github-actions bot closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution
Projects
None yet
Development

No branches or pull requests

1 participant