Commit ecd8b1fa authored by minibikini's avatar minibikini

set concurrency to 1 by default

parent a2f8727d
......@@ -5,5 +5,3 @@ use Mix.Config
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# third-party users, it should be done in your "mix.exs" file.
config :pleroma_job_queue, testing: 2
......@@ -76,8 +76,8 @@ defmodule PleromaJobQueue do
Returns a maximum concurrent jobs for a given queue name.
"""
@spec max_jobs(atom()) :: non_neg_integer()
@spec max_jobs(atom()) :: non_neg_integer() | nil
def max_jobs(queue_name) do
Application.get_env(:pleroma_job_queue, queue_name, 0)
Application.get_env(:pleroma_job_queue, queue_name)
end
end
......@@ -21,11 +21,13 @@ defmodule PleromaJobQueue.WorkerTest do
[state: state]
end
test "creates queue" do
queue = Worker.create_queue(:foobar)
test "create_queue/1" do
{running_jobs, queue} = Worker.create_queue(:foobar)
assert {:foobar, set} = queue
assert :set == set |> elem(0) |> elem(0)
assert queue == []
assert :sets.is_set(running_jobs)
assert :sets.is_empty(running_jobs)
assert PleromaJobQueue.max_jobs(:foobar) == 1
end
test "enqueues an element according to priority" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment