Open sparked435 opened 4 years ago
The method name :connections()
to me suggests an iterator over connections, rather than something that returns a count.
Maybe the existing field .n_connections
could just be documented as part of public API?
That works fine for me.
I assumed that it was a private field that shouldn't be utilized out of fear breaking encapsulation. If that's not a concern, and n_connections can be assumed to be part of the public API going forward, I've already got everything I need in the existing release. I can amend this to just a documentation change.
I'm also okay with renaming it to something like :connection_count(), or just about anything else, if encapsulation is something to worry about.
I'm not particularly concerned about the name. I probably would call it active_connections() but, to your point, that still sounds somewhat like an iterator.
Any of these work for you? number_connections() connection_count() total_connections()
Adds :connections() method to http.server objects, so that external code can see how many client connections are actively being handled.
A project needed this for statistics and load balancing.