Start repo, claude & kimi still vibing tho
This commit is contained in:
28
lib/odinsea/channel/supervisor.ex
Normal file
28
lib/odinsea/channel/supervisor.ex
Normal file
@@ -0,0 +1,28 @@
|
||||
defmodule Odinsea.Channel.Supervisor do
|
||||
@moduledoc """
|
||||
Supervisor for game channel servers.
|
||||
Each channel is a separate TCP listener.
|
||||
"""
|
||||
|
||||
use Supervisor
|
||||
|
||||
require Logger
|
||||
|
||||
def start_link(channel_count) do
|
||||
Supervisor.start_link(__MODULE__, channel_count, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(channel_count) do
|
||||
children =
|
||||
for i <- 1..channel_count do
|
||||
%{
|
||||
id: {Odinsea.Channel.Server, i},
|
||||
start: {Odinsea.Channel.Server, :start_link, [i]}
|
||||
}
|
||||
end
|
||||
|
||||
Logger.info("Starting #{channel_count} game channels")
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user