Current section

Files

Jump to
absinthe lib absinthe subscription proxy_supervisor.ex
Raw

lib/absinthe/subscription/proxy_supervisor.ex

defmodule Absinthe.Subscription.ProxySupervisor do
@moduledoc false
use Supervisor
def start_link(pubsub, registry, pool_size) do
Supervisor.start_link(__MODULE__, {pubsub, registry, pool_size})
end
def init({pubsub, _registry, pool_size}) do
# Shard numbers are generated by phash2 which is 0-based:
children =
for shard <- 0..(pool_size - 1) do
worker(Absinthe.Subscription.Proxy, [pubsub, shard], id: shard)
end
supervise(children, strategy: :one_for_one)
end
end