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

Job posting to balancer and waiting for response should be abstracted in a single method call #8

Open
susamn opened this issue Apr 11, 2020 · 0 comments
Labels
good first issue Good for newcomers

Comments

@susamn
Copy link
Owner

susamn commented Apr 11, 2020

Currently, we post new job to balancer and wait on the request CompletedChannel from the user side, like this:

balancer.PostJob(request)
<-request.CompletedChannel

We should merge this together and have one method, which will either:

  • Fail immediately if the request validation fails
  • Block for the whole duration of the job, meaning the method should do the wait on the CompletedChannel. The reason for doing it, if any user of the api forgets to wait on the channel, the worker for that request will block indefinitely and there will be less workers in balancer. Balancer unknowingly will queue new work for that worker and when the buffer fills up, it will block also.
@susamn susamn added the good first issue Good for newcomers label Apr 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant