Skip to content

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

@renatomassaro

Description

@renatomassaro

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".

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions