Reconnecting to a remote node

Background

I’ve got two nodes, one is the “notifier” the other is the “consumer”. The consumer subscribes to (using GenStage) the notifier. When they lose connection I get a message DOWN with :noconnection. I’m currently letting the consumer crash and restart using my supervisor. This works except for the error logs it generates.

Question

How do I capture that message, wait for a short time, and then re-establish the connection to the remote node?

Currently, thinking something like this:

def handle_info({:DOWN, _ref, :process, _info, :noconnection}, state) do
  Process.sleep(500)
  {:stop, :restart, state}
end

But I think the non-normal stop will still log an error before restarting.

If I use :noreply instead the supervisor won’t restart the consumer. Will the connection be re-established by GenStage (or something underneath) once it is reachable again? The answer appears to be yes based on this post: Autoreconnect nodes

But, it’s still unclear to me if it’s safe (or a terrible idea) to just eternally swallow the DOWN message.

How would you handle this scenario?

Had a conversation: https://github.com/elixir-lang/gen_stage/issues/228