Giter Club home page Giter Club logo

Comments (2)

josevalim avatar josevalim commented on September 27, 2024 1

You should use GenStage.demand(producer, :accumulate) or already start the producer with it set to accumulate so it doesn't emit events until the whole Flow pipeline is subscribed. Otherwise I am worried about silently ignoring "noproc" as it may hide other failures. Thanks for the report!

from flow.

sunaku avatar sunaku commented on September 27, 2024

Wonderful! 🎉 Setting that :accumulate flag on GenStage.demand solved the problem. 👍 Thanks.

iex(4)> {:ok, producer} = GenStage.from_enumerable(1..3, link: false); GenStage.demand(producer, :accumulate); Flow.from_stages([producer], stages: 1) |> Flow.partition(stages: 3) |> Flow.map(fn i -> ms = :timer.seconds(i); IO.inspect("#{inspect(self)}: sleep #{i}"); Process.sleep(ms); ms end) |> Enum.to_list()
"#PID<0.1107.0>: sleep 2"
"#PID<0.1108.0>: sleep 1"
"#PID<0.1108.0>: sleep 3"
[2000, 1000, 3000]

from flow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.