Waiting until all jobs had been completed
Opened this issue · 1 comments
ortuman commented
Trying to send N
jobs and wait until all of them are completed, is correct to assume that JobHandler
will be always called, even when an error occurs?
Currently I'm using a sync.WaitGroup
, so in the case that not all of the response handlers are invoked the client could hang forever, and would like to make sure this should never happen.
Thanks in advance, and congrats for the job! :)
mikespook commented
How about using a channel and a goroutine to collect results? JobHandler
receives the data and sends to the chan, then you can put a timeout into the select
goroutine.