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(dialyzer): the pattern false can never match the type true (#21) #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions lib/que/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ defmodule Que.Worker do




@doc """
Checks if the specified module is a valid Que Worker

Expand Down Expand Up @@ -181,13 +180,27 @@ defmodule Que.Worker do
end
end

def __after_compile__(%{module: module}, _bytecode) do
# Raises error if the Worker doesn't export a perform/1 method
unless Module.defines?(module, {:perform, 1}) do
raise Que.Error.InvalidWorker,
"#{ExUtils.Module.name(module)} must export a perform/1 method"
end

concurrency = module.concurrency()

# Raise error if the concurrency option in invalid
unless concurrency == :infinity or (is_integer(concurrency) and concurrency > 0) do
raise Que.Error.InvalidWorker,
"#{ExUtils.Module.name(module)} has an invalid concurrency value"
end
end


@doc false
defmacro __using__(opts \\ []) do
quote bind_quoted: [opts: opts] do
@after_compile __MODULE__
@after_compile Que.Worker
@concurrency opts[:concurrency] || 1


Expand Down Expand Up @@ -218,22 +231,6 @@ defmodule Que.Worker do



# Make sure the Worker is valid
def __after_compile__(_env, _bytecode) do

# Raises error if the Worker doesn't export a perform/1 method
unless Module.defines?(__MODULE__, {:perform, 1}) do
raise Que.Error.InvalidWorker,
"#{ExUtils.Module.name(__MODULE__)} must export a perform/1 method"
end


# Raise error if the concurrency option in invalid
unless @concurrency == :infinity or (is_integer(@concurrency) and @concurrency > 0) do
raise Que.Error.InvalidWorker,
"#{ExUtils.Module.name(__MODULE__)} has an invalid concurrency value"
end
end

end
end
Expand Down