projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Content-Disposition regex improvements
[akkoma]
/
lib
/
pleroma
/
jobs.ex
diff --git
a/lib/pleroma/jobs.ex
b/lib/pleroma/jobs.ex
index dff0f21970414cdfdb3308286817273d8000bc18..24b7e5e466261e86a9f1ba975cc1597007f43cf8 100644
(file)
--- a/
lib/pleroma/jobs.ex
+++ b/
lib/pleroma/jobs.ex
@@
-40,7
+40,7
@@
defmodule Pleroma.Jobs do
## Arguments
- `queue_name` - a queue name(must be specified in the config).
## Arguments
- `queue_name` - a queue name(must be specified in the config).
- - `mod` - a worker module
, must have `perform` function
.
+ - `mod` - a worker module
(must have `perform` function)
.
- `args` - a list of arguments for the `perform` function of the worker module.
- `priority` - a job priority (`0` by default).
- `args` - a list of arguments for the `perform` function of the worker module.
- `priority` - a job priority (`0` by default).
@@
-77,7
+77,7
@@
defmodule Pleroma.Jobs do
end
else
@spec enqueue(atom(), atom(), [any()], integer()) :: :ok
end
else
@spec enqueue(atom(), atom(), [any()], integer()) :: :ok
- def enqueue(queue_name, mod, args, priority
\\ 1
) do
+ def enqueue(queue_name, mod, args, priority) do
GenServer.cast(__MODULE__, {:enqueue, queue_name, mod, args, priority})
end
end
GenServer.cast(__MODULE__, {:enqueue, queue_name, mod, args, priority})
end
end
@@
-95,11
+95,6
@@
defmodule Pleroma.Jobs do
{:noreply, state}
end
{:noreply, state}
end
- def handle_cast(m, state) do
- IO.inspect("Unknown: #{inspect(m)}, #{inspect(state)}")
- {:noreply, state}
- end
-
def handle_info({:DOWN, ref, :process, _pid, _reason}, state) do
queue_name = state.refs[ref]
def handle_info({:DOWN, ref, :process, _pid, _reason}, state) do
queue_name = state.refs[ref]
@@
-107,7
+102,11
@@
defmodule Pleroma.Jobs do
running_jobs = :sets.del_element(ref, running_jobs)
running_jobs = :sets.del_element(ref, running_jobs)
- state = state |> remove_ref(ref) |> maybe_start_job(queue_name, running_jobs, queue)
+ state =
+ state
+ |> remove_ref(ref)
+ |> update_queue(queue_name, {running_jobs, queue})
+ |> maybe_start_job(queue_name, running_jobs, queue)
{:noreply, state}
end
{:noreply, state}
end
@@
-123,7
+122,7
@@
defmodule Pleroma.Jobs do
|> add_ref(queue_name, mref)
|> update_queue(queue_name, {:sets.add_element(mref, running_jobs), queue})
else
|> add_ref(queue_name, mref)
|> update_queue(queue_name, {:sets.add_element(mref, running_jobs), queue})
else
- update_queue(state, queue_name, {running_jobs, queue})
+ state
end
end
end
end