A tty error comes close in time to the interface going down. Since tty
errors end up restarting the ExChat GenServer, there's a flurry of
pointless activity that occurs as supervisors do their thing. This slows
down the cycle by inserting a sleep. The end result is that when the
interface goes down, ExChat is stopped and no spinning on tty errors
happens. If, somehow, there is a tty error unrelated to the port going
down, retrying after a second seems reasonable.
A tty error comes close in time to the interface going down. Since tty errors end up restarting the ExChat GenServer, there's a flurry of pointless activity that occurs as supervisors do their thing. This slows down the cycle by inserting a sleep. The end result is that when the interface goes down, ExChat is stopped and no spinning on tty errors happens. If, somehow, there is a tty error unrelated to the port going down, retrying after a second seems reasonable.