Skip to content

Commit

Permalink
Don't close the connection from the heartbeat if it's already closing.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuetschard committed Dec 20, 2018
1 parent 0b091e6 commit c1a39d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gapir/client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
}
}
Expand Down

0 comments on commit c1a39d8

Please sign in to comment.