From aa4154e73c6b276afa9268aed793e6c91085835b Mon Sep 17 00:00:00 2001 From: "diamondburned (Forefront)" Date: Mon, 20 Jan 2020 01:32:28 -0800 Subject: [PATCH] Minor fixes that doesn't really fix anything --- gateway/gateway.go | 16 +++++++++------- gateway/pacemaker.go | 4 +--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gateway/gateway.go b/gateway/gateway.go index b3a9baf..daec068 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -293,14 +293,16 @@ func (g *Gateway) handleWS(stop <-chan struct{}) { select { case <-stop: return - case <-g.paceDeath: - // Pacemaker died, pretty fatal. We'll reconnect though. - if err := g.Reconnect(); err != nil { - // Very fatal if this fails. We'll warn the user. - g.FatalLog(errors.Wrap(err, "Failed to reconnect")) + case err := <-g.paceDeath: + if err != nil { + // Pacemaker died, pretty fatal. We'll reconnect though. + if err := g.Reconnect(); err != nil { + // Very fatal if this fails. We'll warn the user. + g.FatalLog(errors.Wrap(err, "Failed to reconnect")) - // Then, we'll take the safe way and exit. - return + // Then, we'll take the safe way and exit. + return + } } case ev := <-ch: diff --git a/gateway/pacemaker.go b/gateway/pacemaker.go index 395bb41..66511ce 100644 --- a/gateway/pacemaker.go +++ b/gateway/pacemaker.go @@ -86,9 +86,7 @@ func (p *Pacemaker) start(stop chan struct{}) error { p.SentBeat = time.Now() if p.Dead() { - if err := p.OnDead(); err != nil { - return err - } + return ErrDead } } }