getsentry / raven-go

Sentry client in Go
https://sentry.io
BSD 3-Clause "New" or "Revised" License
561 stars 148 forks source link

Wait all message sent when close client #163

Open edgesite opened 6 years ago

edgesite commented 6 years ago

Maybe we could make Client.Close likes:

func (client *Client) Close() {
  close(client.queue)
  waitCh := make(chan struct{})
  go func() {
    client.wg.Wait()
    waitCh <- struct{}{}
  }()
  select {
  case <-time.NewTimer(SEND_TIMEOUT):
  case <-waitCh:
  }
}

That would be helpful if we want to send all errors in the signal handler.