diff options
Diffstat (limited to 'pkg/discord')
| -rw-r--r-- | pkg/discord/gateway/gateway.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/discord/gateway/gateway.go b/pkg/discord/gateway/gateway.go index 6fe0087..9c86bb6 100644 --- a/pkg/discord/gateway/gateway.go +++ b/pkg/discord/gateway/gateway.go @@ -76,7 +76,14 @@ func (g *GatewayImpl) Start(ctx context.Context, url string, token string) error } func (g *GatewayImpl) Close() error { - return g.conn.Close() + // Try closing gracefully. + g.logger.Debug().Msg("closing gateway gracefully...") + if err := g.conn.Close(1000); err != nil { + g.logger.Error().Err(err).Msg("error closing gateway gracefully, trying to murder...") + return g.conn.Kill() + } + + return nil } func (g *GatewayImpl) Heartbeat() error { |
