Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Wait all message sent when close client #163

Open
edgesite opened this issue Dec 7, 2017 · 0 comments
Open

Wait all message sent when close client #163

edgesite opened this issue Dec 7, 2017 · 0 comments

Comments

@edgesite
Copy link

edgesite commented Dec 7, 2017

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.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant