Packages
honeydew
1.2.5
1.5.0
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.0
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc7
1.0.0-rc6
1.0.0-rc5
1.0.0-rc4
1.0.0-rc3
1.0.0-rc2
1.0.0-rc1
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Pluggable local/clusterable job queue focused on safety.
Current section
Files
Jump to
Current section
Files
lib/honeydew/worker_starter.ex
# when a queue comes online (or its node connects), it sends a message to this process to start workers.
defmodule Honeydew.WorkerStarter do
use GenServer
alias Honeydew.WorkerGroupSupervisor
require Logger
# called by a queue to tell the workerstarter to start workers
def queue_available(queue, node) do
GenServer.cast({Honeydew.process(queue, __MODULE__), node}, {:queue_available, self()})
end
def start_link(queue) do
GenServer.start_link(__MODULE__, queue, name: Honeydew.process(queue, __MODULE__))
end
def init(queue) do
# this process starts after the WorkerGroupSupervisor, so we can send it start requests
queue
|> Honeydew.get_all_queues
|> Enum.each(&WorkerGroupSupervisor.start_worker_group(queue, &1))
{:ok, queue}
end
def handle_cast({:queue_available, queue_pid}, queue) do
Logger.info "[Honeydew] Queue process #{inspect queue_pid} from #{inspect queue} on node #{node(queue_pid)} became available, starting workers ..."
{:ok, _} = WorkerGroupSupervisor.start_worker_group(queue, queue_pid)
{:noreply, queue}
end
end