Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waiting until all jobs had been completed #83

Open
ortuman opened this issue Feb 17, 2018 · 1 comment
Open

Waiting until all jobs had been completed #83

ortuman opened this issue Feb 17, 2018 · 1 comment

Comments

@ortuman
Copy link

ortuman commented Feb 17, 2018

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
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants