Skip to content

Commit

Permalink
use :one_for_all websocks restart strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
4DA committed Feb 10, 2021
1 parent 7a25d37 commit 26a5333
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/app/state_manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ defmodule StateManager do
%{
id: "Bleroma.Websocks.#{tg_user_id}",
start: {Bleroma.Websocks, :start_link, [{tg_user_id, conn}]},
restart: :transient
restart: :transient,
strategy: :one_for_all
})
end

Expand Down
5 changes: 3 additions & 2 deletions lib/app/websocks.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ defmodule Bleroma.Websocks do
{:ok, state}
end

def handle_disconnect(disconnect_map, state) do
Logger.info("Remote close")
def handle_disconnect(disconnect_map, {tg_id, conn} = state) do
Logger.log(:info,
"Disconnected WS [pid=#{inspect self()}, tg_id: #{tg_id}, acc: #{conn.acct}]")
super(disconnect_map, state)
end

Expand Down

0 comments on commit 26a5333

Please sign in to comment.