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

Flow's Sync driver does not handle nested callbacks #29

Open
renatomassaro opened this issue Dec 26, 2017 · 1 comment
Open

Flow's Sync driver does not handle nested callbacks #29

renatomassaro opened this issue Dec 26, 2017 · 1 comment

Comments

@renatomassaro
Copy link
Member

I've noticed a nested flow was not executing on_success or on_done callbacks, even though it ran successfully. Actually, only the first flow would execute.

    case get_flow() do
      {flow, 1} ->
        __driver__().execute_success(flow)
        Process.delete(:heflow)
      _ ->
        :ok

The case above led me to believe only the flow with counter 1 was being executed. Counter is not documented so I'm assuming it's a stack counter.

I've tried adding a handler for {flow, n}, and updating the :heflow process with {pid, n - 1}, similar to how it's defined on __finish__:

  def __finish__ do
    case get_flow() do
      {_, 1} ->
        Process.delete(:heflow)
      {flow, n} ->
        Process.put(:heflow, {flow, n - 1})
      nil ->
        :ok
    end
  end

No luck. By doing so, Flow enters on an infinite loop waiting for the synchronous receive. Async works fine (no need for any change). May need a couple tweaks on the Manager or how the Driver works, but since nothing is documented it's hard to spot what without going "all in".

@renatomassaro
Copy link
Member Author

Hit this bug again on a non-nested callback. on_success, on_done and on_fail callbacks are completely ignored on Synchronous driver (haven't tested with async but it probably would work).

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

No branches or pull requests

1 participant