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

fix: type spec on unique field #1023

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

andrew-combs
Copy link
Contributor

I noticed that when implementing the Oban.Job.new/2 callback, specifying a list of unique fields caused a "No local return" warning:

defmodule MyApp do
  use Oban.Worker

  @impl true
  def new(args, _opts) do
    # Function new/2 has no local return.ElixirLS Dialyzer
    Oban.Job.new(args, worker: __MODULE__, unique: [fields: [:args], keys: [:id]])
  end

end

This appears related to the Oban.Job.unique_field type being a list type, which is then wrapped again in the @type unique_option :: {:fields, [unique_field()]} | ... type.

For consistency, I removed the list spec in the unique_field type rather than the unique_option type.

@sorentwo sorentwo merged commit 3140763 into oban-bg:main Jan 26, 2024
2 checks passed
@sorentwo
Copy link
Member

Thanks for the fix!

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

Successfully merging this pull request may close these issues.

2 participants