mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-12-01 08:37:23 +00:00
Gateway: Minor bug fixes
This commit is contained in:
parent
14b9d8f43a
commit
0aebea60bd
|
|
@ -329,7 +329,7 @@ func (g *Gateway) eventLoop() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
return errors.New("Pacemaker died, reconnecting.")
|
||||
return errors.Wrap(err, "Pacemaker died, reconnecting")
|
||||
|
||||
case ev := <-ch:
|
||||
// Check for error
|
||||
|
|
|
|||
|
|
@ -77,21 +77,22 @@ func (p *Pacemaker) start(stop chan struct{}, wg *sync.WaitGroup) error {
|
|||
p.Echo()
|
||||
|
||||
for {
|
||||
if err := p.Pace(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Paced, save:
|
||||
atomic.StoreInt64(&p.SentBeat, time.Now().UnixNano())
|
||||
|
||||
if p.Dead() {
|
||||
return ErrDead
|
||||
}
|
||||
|
||||
select {
|
||||
case <-stop:
|
||||
return nil
|
||||
|
||||
case <-tick.C:
|
||||
if err := p.Pace(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Paced, save:
|
||||
atomic.StoreInt64(&p.SentBeat, time.Now().UnixNano())
|
||||
|
||||
if p.Dead() {
|
||||
return ErrDead
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@ func (ws *Websocket) Dial(ctx context.Context) error {
|
|||
return errors.Wrap(err, "Failed to dial")
|
||||
}
|
||||
|
||||
// Reset the SendLimiter:
|
||||
ws.SendLimiter = NewSendLimiter()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue