Oban unique job with nested key in args?

I’d like to match on args.options.project_id, but it seems that Oban.Worker :keys must be a list of atoms. Is it possible to pass in a get_in function like get_in(["options", "project_id"])?

Nope, you can only match on top level keys. If you want to set uniqueness with project_id, that has to be a top level key. :

%{options: %{project_id: 123}}

%{project_id: 123, options: %{...}}
1 Like

Ah bummer. Any hope for nested keys to be in a future release?

This is the first time somebody has requested it as a feature. There aren’t any plans to add it at this point, as it’s easily worked around with a little duplication, but we’ll keep it in mind :slightly_smiling_face: