Closed roma86 closed 8 years ago
Thanks for the report. Will look into it.
I'm definitely seeing this issue using the -n
flag to example/concurrent
. Sometimes all the responses come back, sometimes not. Still investigating.
go run main.go -c cert.p12 -d device_token -n 20
Are you also finding that sometimes you receive all responses and other times not?
Right now calling queue.Wait()
waits until all the responses are sent (which also means all responses are received).
However, it's possible that the goroutine reading the responses hasn't finished yet when the program exits.
I added some logging introduced a time.Sleep
before exiting and occasionally saw this behaviour:
17:20:38.065437 (19) apns-id: D989EEA8-37F8-A681-B578-B4C6F0FC327F
17:20:38.065448 response sent 5ABCCCD8-1034-59AD-78C9-680199E0687B
17:20:38.065458 done
17:20:38.065475 (20) apns-id: 5ABCCCD8-1034-59AD-78C9-680199E0687B
the final response is sent, queue.Wait()
wraps up, and the program would then exit -- but thanks to sleeping for a second, we do see the final response.
the proper solution is to add a WaitGroup or done channel to your own code. see #75
What did you do? (steps to reproduce or a code sample is helpful)
What did you expect to see?
What did you see instead?