zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

supervisor.ex (856B)


      1 defmodule Absinthe.Subscription.Supervisor do
      2   @moduledoc false
      3 
      4   use Supervisor
      5 
      6   def start_link(pubsub, pool_size \\ System.schedulers_online() * 2) do
      7     pubsub =
      8       case pubsub do
      9         [module] when is_atom(module) ->
     10           module
     11 
     12         module ->
     13           module
     14       end
     15 
     16     Supervisor.start_link(__MODULE__, {pubsub, pool_size})
     17   end
     18 
     19   def init({pubsub, pool_size}) do
     20     registry_name = Absinthe.Subscription.registry_name(pubsub)
     21     meta = [pool_size: pool_size]
     22 
     23     children = [
     24       {Registry,
     25        [
     26          keys: :duplicate,
     27          name: registry_name,
     28          partitions: System.schedulers_online(),
     29          meta: meta,
     30          compressed: true
     31        ]},
     32       {Absinthe.Subscription.ProxySupervisor, [pubsub, registry_name, pool_size]}
     33     ]
     34 
     35     Supervisor.init(children, strategy: :one_for_one)
     36   end
     37 end