This commit is contained in:
Egor Kislitsyn 2019-01-28 23:12:02 +07:00
parent 55affbca7f
commit b2e9700785
1 changed files with 1 additions and 7 deletions

View File

@ -40,7 +40,7 @@ def create_queue(name) do
## Arguments ## Arguments
- `queue_name` - a queue name(must be specified in the config). - `queue_name` - a queue name(must be specified in the config).
- `mod` - a worker module, must have `perform` function. - `mod` - a worker module (must have `perform` function).
- `args` - a list of arguments for the `perform` function of the worker module. - `args` - a list of arguments for the `perform` function of the worker module.
- `priority` - a job priority (`0` by default). - `priority` - a job priority (`0` by default).
@ -76,7 +76,6 @@ def enqueue(_queue_name, mod, args, _priority) do
apply(mod, :perform, args) apply(mod, :perform, args)
end end
else else
@spec enqueue(atom(), atom(), [any()], integer()) :: :ok
def enqueue(queue_name, mod, args, priority \\ 1) do def enqueue(queue_name, mod, args, priority \\ 1) do
GenServer.cast(__MODULE__, {:enqueue, queue_name, mod, args, priority}) GenServer.cast(__MODULE__, {:enqueue, queue_name, mod, args, priority})
end end
@ -95,11 +94,6 @@ def handle_cast({:enqueue, queue_name, mod, args, priority}, state) do
{:noreply, state} {:noreply, state}
end end
def handle_cast(m, state) do
IO.inspect("Unknown: #{inspect(m)}, #{inspect(state)}")
{:noreply, state}
end
def handle_info({:DOWN, ref, :process, _pid, _reason}, state) do def handle_info({:DOWN, ref, :process, _pid, _reason}, state) do
queue_name = state.refs[ref] queue_name = state.refs[ref]