akira/exq

handling queue concurrency of invalid type

akash-akya opened this issue · 0 comments

Exq does not validate or handle queue level concurrency if the value is of type string (non-integer). If we set a string as a concurrency value, Exq behaves as if it's set to infinity (because of how comparison between int and string works in Elixir/Erlang)

Ideally it should fail or try to convert string to integer. Global concurrency seems to handle these cases.

Example:

iex -S mix run --no-start

defmodule TestWorker do
  def perform, do: :ok
end

Exq.start_link(queues: [{"test", "0"}])
{:ok, _} = Exq.enqueue(Exq, "test", TestWorker, [])

:timer.sleep(500)

{:ok, 1} = Exq.Api.stats(Exq.Api, :processed)