zenoh icon indicating copy to clipboard operation
zenoh copied to clipboard

Avoid hanging when querying a local queryable when using async and flume handlers

Open OlivierHecart opened this issue 2 years ago • 0 comments

Problem: The following example hangs:

    let queryable = session
        .declare_queryable("test")
        .res()
        .await
        .unwrap();

    loop {
        select!(
            _query = queryable.recv_async() => {},
            _ = stdin.read_exact(&mut input).fuse() => {
                let replies = session.get("test").res().await.unwrap();
                while let Ok(_reply) = replies.recv_async().await {}
                return
            },
        );
    }

Proposed solution: The async get() resolver should have a specific async implementation that asyncly waits for replies from the replies flume channel.

Note: other resolvers would also benefit from a specific async implementation.

OlivierHecart avatar Sep 20 '22 09:09 OlivierHecart