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

Back-pressure doesn't work with sub dispatches #3376

Open
ronag opened this issue Jun 26, 2024 · 0 comments
Open

Back-pressure doesn't work with sub dispatches #3376

ronag opened this issue Jun 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ronag
Copy link
Member

ronag commented Jun 26, 2024

  1. No back-pressure for interceptor composed dispatcher through dispatch(opts, handler)
  2. Async backpressure broken for sub dispatches, i.e. Pool makes false assumptions that nobody else has dispatched anything to its children. There is no way to know if a child can receive additional work without calling dispatch first at which point the request is already queued and can't be dispatched to another non-busy child.
  3. Back-pressure is global even though children depend on the actual request options, e.g. Agent depends on opts.origin to pick its child and a 'drain' event doesn't necessarily mean that a request can be dispatched, which becomes a bigger issue due to 2.
  • Adding a get busy() property on the Dispatcher interface will not work due to 3.
  • Adding a 'busy' event to the Dispatcher interface will not work due to 3.

The only viable solution I can find is some kind of tryDispatch(opts, handler, onDrain) API with a onDrain(err) callback and keep dispatch(opts, handler) as a fire and forget API and then deprecate the 'drain' event + boolean return value of dispatch(opts, handler):boolean.

@ronag ronag added the bug Something isn't working label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant