Skip to content

Commit

Permalink
Add a dynamic supervisor to the library
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilger committed Jan 4, 2024
1 parent 3d0a39a commit 65c5185
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/gpt_agent/supervisor.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defmodule GptAgent.Supervisor do
@moduledoc """
Manages the GptAgent processes, ensuring that there is only one process per thread-id.
"""

use DynamicSupervisor

def start_link(init_arg) do
DynamicSupervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
end

@impl DynamicSupervisor
def init(_init_arg) do
DynamicSupervisor.init(strategy: :one_for_one)
end
end

0 comments on commit 65c5185

Please sign in to comment.