rio icon indicating copy to clipboard operation
rio copied to clipboard

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

Open susamn opened this issue 4 years ago • 0 comments

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 avatar Apr 11 '20 12:04 susamn