ryanwinchester
Oban Sub-Workflow inherits parent initial context and ignores any additional context
(Oban Pro 1.6.0-rc.4)
When I create a sub-workflow, it gets the parent workflow’s put_context
while losing the parent workflows add_cascade additions to context
as well as the sub-workflow’s own put_context
Example of what I am experiencing (simplified):
def foo_workflow do
Workflow.new()
|> Workflow.put_context(%{foo: 1})
|> Workflow.add_cascade(:bar, &get_bar/1)
|> Workflow.add_graft(:baz, &baz_workflow/1)
end
def get_bar(%{}), do: 2
def baz_workflow(%{}) do
Workflow.new()
|> Workflow.put_context(%{banana: "yum"})
|> Workflow.add_cascade(:help, &help/1)
|> Workflow.apply_graft()
|> Oban.insert_all()
:ok
end
def help(%{banana: banana}) do
# this will not match because it has:
#
# %{foo: 1}
#
# but I am expecting to be able to match
# on `:banana` key.
#
# Sometimes `baz_workflow` is used on its own,
# and sometimes as a sub-workflow in `foo_workflow`.
end
Marked As Solved
sorentwo
Oban Core Team
It wasn’t supposed to be. Just a bug in the query. It’s fixed for the next RC, slated in the next couple of days.
1
Also Liked
sorentwo
Oban Core Team
Thanks for the report! You’ve hit on some things that should be explained, warned about, or possibly fixed in workflows.
The context is pulled from the current workflow, then the parent workflow if nothing was found; they aren’t merged. They certainly could be though. The top level cascade (:bar) could probably be propagated down to the sub-workflow as well.
Looking into some fixes and improvements now.
2
Popular in Questions
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Lets say I have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Other popular topics
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








