Replies: 2 comments 6 replies
-
Most of those properties are needed in one way or another to implement the level above in a performant or reliable way. All of them are useful for me. A few are more important than others, e.g. It's not necessary for them to be part of the Dispatcher API in any way. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I see undici primarily as a low level library with some common sense APIs to build more advanced things on top of. Hence I believe our priorities are (in order of importance) correctness, performance and maintainability.
The current API has a lot of convenience methods and properties that bring maintenance burden. I would like to challenge us to try and remove some to reduce duplication of functionality and improve maintainability.
I propose to remove the following properties and methods:
Dispatcher.close
Pool.close()
Pool.closed
Pool.url
Pool.connected
Pool.pending
Pool.size
Pool.running
Pool.busy
Client.close()
Client.closed
Client.url
Client.connected
Client.pending
Client.size
Client.running
Client.busy
Agent.close
Agent.connected
Agent.closed
Agent.pending
Agent.size
Agent.running
Reducing the API surface makes:
Dispatcher
.In order to not lose functionality and make the above still achievable in user land I propose to add the following events:
'pending'
- on request queued'running'
- on request running'complete'
- on request complete'failed'
- on request failedThese events are something I would like to add regardless of the above for better introspection.
Thoughts? Please do push back. I know I have a bias towards simplicity at the cost of functionality and convenience.
Beta Was this translation helpful? Give feedback.
All reactions