Skip to content

Commit

Permalink
Ignore an old commands_done message when retrying
Browse files Browse the repository at this point in the history
This adds a handler to ignore a latent message rather than crashing.
Crashing turned out to be harmless, but the log message caused concern.
This just ignores the event, since that's the right handling anyway.
  • Loading branch information
fhunleth committed Apr 6, 2020
1 parent a6da84a commit 95a6738
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/vintage_net/interface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,15 @@ defmodule VintageNet.Interface do
end
end

@impl true
def handle_event(:info, {:commands_done, _}, :retrying, %State{} = data) do
# This is a latent message that didn't get processed because a crash
# got handled first. It can be produced by getting one of an
# interface's supervised processes to crash on a
# VintageNet.deconfigure/1 call.
{:keep_state, data}
end

# Catch all event handlers
@impl true
def handle_event(:info, {:EXIT, _pid, _reason}, _state, data) do
Expand Down

0 comments on commit 95a6738

Please sign in to comment.