Skip to content

Commit 1cade7c

Browse files
committed
Cleanup unused vars
1 parent 4652c37 commit 1cade7c

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

lib/exq/manager/server.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ defmodule Exq.Manager.Server do
228228
{:noreply, state, 0}
229229
end
230230

231-
def handle_cast({:job_terminated, _namespace, queue, job_json}, state) do
231+
def handle_cast({:job_terminated, _namespace, queue, _job_json}, state) do
232232
update_worker_count(state.work_table, queue, -1)
233233
{:noreply, state, 0}
234234
end

lib/exq/worker/server.ex

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ defmodule Exq.Worker.Server do
6868
job = Exq.Support.Job.from_json(state.job_json)
6969
target = String.replace(job.class, "::", ".")
7070
[mod | _func_or_empty] = Regex.split(~r/\//, target)
71-
func = :perform
7271
GenServer.cast(self, :dispatch)
7372
{:noreply, %{state | worker_module: String.to_atom("Elixir.#{mod}"),
7473
job: job, process_info: process_info } }
@@ -79,7 +78,7 @@ defmodule Exq.Worker.Server do
7978
Dispatch work to the target module (call :perform method of target)
8079
"""
8180
def handle_cast(:dispatch, state) do
82-
dispatch_work(state, state.worker_module, state.job.args)
81+
dispatch_work(state.worker_module, state.job.args)
8382
{:noreply, state }
8483
end
8584

@@ -91,7 +90,7 @@ defmodule Exq.Worker.Server do
9190
{:stop, :normal, state }
9291
end
9392

94-
def handle_info({:DOWN, mref, _, worker, :normal}, state) do
93+
def handle_info({:DOWN, _, _, _, :normal}, state) do
9594
{:noreply, state}
9695
end
9796

@@ -100,7 +99,7 @@ defmodule Exq.Worker.Server do
10099
{:stop, :normal, state}
101100
end
102101

103-
def handle_info(info, state) do
102+
def handle_info(_info, state) do
104103
{:noreply, state}
105104
end
106105

@@ -112,12 +111,12 @@ defmodule Exq.Worker.Server do
112111
## Internal Functions
113112
##===========================================================
114113

115-
def dispatch_work(state, worker_module, args) do
114+
def dispatch_work(worker_module, args) do
116115
# trap exit so that link can still track dispatch without crashing
117116
Process.flag(:trap_exit, true)
118117
worker = self
119118
pid = spawn_link fn ->
120-
result = apply(worker_module, :perform, args)
119+
apply(worker_module, :perform, args)
121120
GenServer.cast(worker, :done)
122121
end
123122
Process.monitor(pid)
@@ -151,7 +150,7 @@ defmodule Exq.Worker.Server do
151150
case is_alive?(state.stats) do
152151
nil ->
153152
Logger.error("Worker terminated, but stats was not alive.")
154-
pid ->
153+
_pid ->
155154
Stats.process_terminated(state.stats, state.namespace, state.process_info)
156155
Stats.record_processed(state.stats, state.namespace, state.job)
157156
end
@@ -160,7 +159,7 @@ defmodule Exq.Worker.Server do
160159
case is_alive?(state.stats) do
161160
nil ->
162161
Logger.error("Worker terminated, but stats was not alive.")
163-
pid ->
162+
_pid ->
164163
Stats.process_terminated(state.stats, state.namespace, state.process_info)
165164
Stats.record_failure(state.stats, state.namespace, to_string(error_msg), state.job)
166165
end
@@ -185,5 +184,5 @@ defmodule Exq.Worker.Server do
185184
defp is_alive?(sup) when is_atom(sup) do
186185
Process.whereis(sup)
187186
end
188-
defp is_alive(_), do: false
187+
defp is_alive?(_), do: false
189188
end

test/test_helper.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ defmodule ExqTestUtil do
4646
Process.flag(:trap_exit, true)
4747
Process.exit(pid, :shutdown)
4848
receive do
49-
{:EXIT, _pid, error} -> :ok
49+
{:EXIT, _pid, _error} -> :ok
5050
end
5151
rescue
5252
e in RuntimeError -> e

0 commit comments

Comments
 (0)