Skip to content

Commit

Permalink
fix: grpc reconnection fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kstasik committed Feb 10, 2021
1 parent e50a1c8 commit d7dbd5e
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions exporters/otlp/otlpgrpc/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,23 @@ func (c *connection) indefiniteBackgroundConnection() {
// 1. If we've stopped, return entirely
// 2. Otherwise block until we are disconnected, and
// then retry connecting
select {
case <-c.stopCh:
return

case <-c.disconnectedCh:
// Quickly check if we haven't stopped at the
// same time.
if c.connected() {
select {
case <-c.stopCh:
return

default:
}
case <-c.disconnectedCh:
// Quickly check if we haven't stopped at the
// same time.
select {
case <-c.stopCh:
return

default:
}

// Normal scenario that we'll wait for
// Normal scenario that we'll wait for
}
}

if err := c.connect(context.Background()); err == nil {
Expand Down

0 comments on commit d7dbd5e

Please sign in to comment.