Skip to content

Commit

Permalink
Update lib/phoenix/tracker/shutdown_handler.ex
Browse files Browse the repository at this point in the history
Co-authored-by: José Valim <[email protected]>
  • Loading branch information
nathanl and josevalim authored Sep 27, 2024
1 parent 8f37d1f commit a44e701
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/phoenix/tracker/shutdown_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ defmodule Phoenix.Tracker.ShutdownHandler do
@moduledoc false
use GenServer

def start_link(opts) do
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
def start_link(tracker) do
GenServer.start_link(__MODULE__, tracker, name: __MODULE__)
end

@impl GenServer
def init(opts) do
tracker = Keyword.fetch!(opts, :tracker)
def init(tracker) do
Process.flag(:trap_exit, true)
{:ok, %{tracker: tracker}}
{:ok, tracker}
end

@impl GenServer
def terminate(_reason, state) do
Phoenix.Tracker.graceful_permdown(state.tracker)
def terminate(_reason, tracker) do
Phoenix.Tracker.graceful_permdown(tracker)
:ok
end
end

0 comments on commit a44e701

Please sign in to comment.