Skip to content

Commit

Permalink
fix improper list
Browse files Browse the repository at this point in the history
  • Loading branch information
korialis committed Dec 2, 2022
1 parent f7b9995 commit 735ddd3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/exq/redis/job_queue.ex
Expand Up @@ -35,7 +35,7 @@ defmodule Exq.Redis.JobQueue do
try do
[unlocks_in, unique_key] = unique_args(namespace, job, options)

keys = [full_key(namespace, "queues"), queue_key(namespace, queue)] ++ (unique_key || [])
keys = keys_list([full_key(namespace, "queues"), queue_key(namespace, queue)], unique_key)

response =
Script.eval!(
Expand Down Expand Up @@ -98,7 +98,7 @@ defmodule Exq.Redis.JobQueue do
try do
[unlocks_in, unique_key] = unique_args(namespace, job, options)

keys = [scheduled_queue] ++ (unique_key || [])
keys = keys_list([scheduled_queue], unique_key)

response =
Script.eval!(redis, :enqueue_at, keys, [
Expand Down Expand Up @@ -223,6 +223,9 @@ defmodule Exq.Redis.JobQueue do
end
end

defp keys_list([_hd | _tl] = keys, nil), do: keys
defp keys_list([_hd | _tl] = keys, key), do: keys ++ [key]

def full_key("", key), do: key
def full_key(nil, key), do: key

Expand Down

0 comments on commit 735ddd3

Please sign in to comment.