From 36b2997948674288f790c94c2b33559f8d55645c Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Wed, 19 Dec 2018 16:22:30 -0800 Subject: [PATCH] Don't close the connection from the heartbeat if it's already closing. --- gapir/client/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gapir/client/session.go b/gapir/client/session.go index 534ccee99e..a20689b64e 100644 --- a/gapir/client/session.go +++ b/gapir/client/session.go @@ -394,7 +394,6 @@ func (s *session) ping(ctx context.Context) (time.Duration, error) { } func (s *session) heartbeat(ctx context.Context, pingInterval time.Duration) { - defer s.close() for { select { case <-task.ShouldStop(ctx): @@ -403,6 +402,7 @@ func (s *session) heartbeat(ctx context.Context, pingInterval time.Duration) { _, err := s.ping(ctx) if err != nil { log.E(ctx, "Error sending keep-alive ping. Error: %v", err) + s.close(ctx) return } }