Skip to content

Commit

Permalink
Merge pull request #17 from mjm/push-ylkrxquusrrl
Browse files Browse the repository at this point in the history
Gracefully handle termination and unexpected messages
  • Loading branch information
rkallos authored Oct 30, 2024
2 parents 1a10946 + 2252345 commit 21f0759
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/peep.ex
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,18 @@ defmodule Peep do
{:noreply, %State{state | statsd_state: new_statsd_state}}
end

def handle_info(_msg, state) do
# In particular, OTP can sometimes leak `:inet_reply` messages when a UDS datagram
# socket blocks, and Peep should not terminate the server and lose state when that
# happens.
#
# https://github.com/rkallos/peep/pull/17
# https://github.com/erlang/otp/issues/8989
{:noreply, state}
end

@impl true
def terminate(:shutdown, %{handler_ids: handler_ids}) do
def terminate(_reason, %{handler_ids: handler_ids}) do
EventHandler.detach(handler_ids)
end

Expand Down

0 comments on commit 21f0759

Please sign in to comment.