Skip to content

Commit e98e36e

Browse files
refactor
1 parent 2249213 commit e98e36e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

lib/exq/node/server.ex

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,16 @@ defmodule Exq.Node.Server do
103103

104104
case Process.info(worker_pid, :links) do
105105
{:links, links} when length(links) <= 10 ->
106-
job_pid =
107-
Enum.find(links, fn link ->
108-
match?(%Job{jid: ^jid}, Metadata.lookup(state.metadata, link))
109-
end)
110-
111-
if job_pid do
106+
if Enum.any?(links, fn link ->
107+
match?(%Job{jid: ^jid}, Metadata.lookup(state.metadata, link))
108+
end) do
112109
Server.cancel(worker_pid)
113110
Logger.info("Canceled jid #{jid}")
114111
else
115112
Logger.warning("Not able to find worker process to cancel")
116113
end
117114

118-
nil ->
115+
_ ->
119116
Logger.warning("Not able to find worker process to cancel")
120117
end
121118

0 commit comments

Comments
 (0)