Job concurrency limiter in Toniq

I’m using the Toniq library and at the moment, I started getting this error:

Error in process <0.2371.0> on node 'name_project@xxx.xxx.xxx.xxx' with exit value:
{badarg,[{erlang,apply,[[{data,#{}}],max_concurrency,[]],[]},{'Elixir.Toniq.JobConcurrencyLimiter',run,1,[{file,"lib/ toniq/job_concurrency_limiter.ex"},{line,23}]},{'Elixir.Toniq.JobRunner','-handle_cast/2-fun-0-',1,[{file,"lib/toniq/job_runner. ex"},{line,21}]}]}

I’ve searched how to fix the error, but I can’t find anything. What can you do to fix the error? Thank you.

Hi @tmp welcome, can you show the code you have that configures Toniq?

In the config.exs file I have config

:toniq, redis_url: "redis://redis-qa-service:6379/3"

I also have the module that uses it

defmodule BackgroundProcessWorker do
     @moduledoc false

     use Toniq.Worker, max_concurrency: 1
     require Monad.Error, as: Error
     import Failed
     require Logger

     def perform(data: data) do
         ...
     end
end

And here I create the jobs

def basic_deliver(_a, payload) do
        Error.m do
            data <- Poison.decode(payload)
            return(Toniq.enqueue(BackgroundProcessWorker, data: data))
        end
        ...

    end

The error message points to line 23 (the clause for run/1):

The rest of the error message suggests that the argument [data: %{}] is being passed where Job.build expects a module:thinking: