Closed mathieurousseau closed 7 months ago
elixir --version
When defining a queue partition limit as per the doc: https://hexdocs.pm/oban/2.11.0/smart_engine.html#partitioned-rate-limiting global_limit: [allowed: 1, partition: [:worker, :args]] or global_limit: [allowed: 1, partition: [fields: [:worker, :args]]]
global_limit: [allowed: 1, partition: [:worker, :args]]
global_limit: [allowed: 1, partition: [fields: [:worker, :args]]]
it fails pattern matching:
** (CaseClauseError) no case clause matching: %Oban.Pro.Producer.Meta.GlobalLimit.Partition{fields: ["args", "worker"], keys: []} (oban_pro 1.3.1) lib/oban/pro/engines/smart.ex:867: Oban.Pro.Engines.Smart.partition_by_fields/1
Which makes sense as the that code is:
defp partition_by_fields(partition) do case partition do %{fields: ["worker"]} -> [:worker] %{fields: ["args"], keys: []} -> [:args] %{fields: ["args"], keys: keys} -> for key <- keys, do: dynamic([j], fragment("?->>?", j.args, ^key)) end end
Adding a dbg there, the partition is:
partition #=> %Oban.Pro.Producer.Meta.GlobalLimit.Partition{ fields: ["args", "worker"], keys: [] }
We should be able to partition by worker and args at the same time as per the doc.
This was fixed in Pro v1.4.0 🙂
Thanks! Sorry for not spotting that before raising the issue. 🙇
Environment
elixir --version
): Elixir 1.15.7 (compiled with Erlang/OTP 26)Current Behavior
When defining a queue partition limit as per the doc: https://hexdocs.pm/oban/2.11.0/smart_engine.html#partitioned-rate-limiting
global_limit: [allowed: 1, partition: [:worker, :args]]
orglobal_limit: [allowed: 1, partition: [fields: [:worker, :args]]]
it fails pattern matching:
Which makes sense as the that code is:
Adding a dbg there, the partition is:
Expected Behavior
We should be able to partition by worker and args at the same time as per the doc.