elixir-lang / gen_stage

Producer and consumer actors with back-pressure for Elixir
http://hexdocs.pm/gen_stage
1.52k stars 192 forks source link

Added missing code changes on GenStage documentation #210 #211

Closed alvaromlg closed 6 years ago

alvaromlg commented 6 years ago

Pull request for #210 Without these code changes I receive the error

** (Mix) Could not start application testdep: Application.start(:normal, []) returned an error: shutdown: failed to start child: B
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started

After applying the code changes on start_link/1 the application starts correctly and starts counting:

iex(1)> [0, 2, 4, 6, 8]
[10, 12, 14, 16, 18]
[20, 22, 24, 26, 28]
[30, 32, 34, 36, 38]

I didnt suggest to add the named module on consumer GenStage.start_link(C, :ok) because nobody is going to subscribe to the consumer but maybe is a good practice to always name the process, I am not sure about that.

josevalim commented 6 years ago

:heart: :green_heart: :blue_heart: :yellow_heart: :purple_heart: