From f635f32d2b2400f7881d700fa98316fbdb7a694f Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 8 Apr 2022 14:35:47 +0200 Subject: Use time.Duration for heartbeats --- pkg/discord/gateway/gateway.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pkg/discord/gateway/gateway.go') diff --git a/pkg/discord/gateway/gateway.go b/pkg/discord/gateway/gateway.go index 18cf708..d1311c2 100644 --- a/pkg/discord/gateway/gateway.go +++ b/pkg/discord/gateway/gateway.go @@ -7,6 +7,7 @@ import ( "jinx/pkg/discord/events" "jinx/pkg/libs/cancellablewebsocket" "net/http" + "time" "github.com/gorilla/websocket" "github.com/rs/zerolog" @@ -62,7 +63,8 @@ func (g *GatewayImpl) Start(ctx context.Context, url string, token string) error return err } - g.heartbeat.Start(ctx, hello.HeartbeatInterval) + heartbeatInterval := time.Duration(hello.HeartbeatInterval) * time.Millisecond + g.heartbeat.Start(ctx, heartbeatInterval) if err = g.identify(token); err != nil { return err -- cgit 1.4.1