Skip to content

Pipe sometimes skips sent item #4

Description

@mpskowron

Hi,
I had a code like this:

let (mut sender, stream) = mpsc::channel(1000);
tokio::task::spawn(async move {
            while <some_condition> {
                let item = ...
                sender.send(item).await.unwrap();
            }
        });
let stream2 = pipe(Arc::new(Desync::new(0)), stream, move |_, item| {
            let result = ...
            futures::future::ready(result).boxed()
        });

It occurred, that sometimes an item, despite being successfully sent by sender, wasn't processed at all in pipe's closure.
After rewriting the pipe to:

let (mut sender2, stream2) = mpsc::channel(1000);
tokio::task::spawn(async move {
            while let Some(item) = stream.next().await {
                sender2.send(item).await.unwrap();
            }
        });        

Everything started working correctly, thus it seems like it is a bug.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions