43 lines
1.1 KiB
Elixir

defmodule GlobalBackgroundJob.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@impl true
def start(_type, _args) do
children = [
# Starts a worker by calling: GlobalBckJob.Worker.start_link(arg)
# {GlobalBackgroundJob.Worker, arg}
{Cluster.Supervisor, [topologies(), [name: GlobalBackgroundJob.ClusterSupervisor]]},
{GlobalBackgroundJob.DatabaseCleaner.Starter,[timeout: :timer.seconds(2)]}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: GlobalBackgroundJob.Supervisor]
Supervisor.start_link(children, opts)
end
defp topologies do
[
background_job: [
strategy: Cluster.Strategy.Gossip,
config: [
# port: 45892,
if_addr: "0.0.0.0",
# multicast_if: "10.13.4.143", #addr locale
# multicast_addr: "255.255.255.255",
# multicast_ttl: 1,
secret: "secret"
# broadcast_only: true
]
]
]
end
end