Conversation
This method is to count libuv handles of current tick.
|
If we are going to add a method that returns the handles, I think a better place would be |
| }; | ||
| } | ||
|
|
||
| process.LIBUV_HANDLE_TYPES = { |
There was a problem hiding this comment.
We should not hard code this in JS land, this can be attached in the binding - e.g. see require('os').constants
|
@joyeecheung it's not returning the handles but handles count. |
|
What's the use case for this? If it's to find what's keeping a process alive, don't we have user-friendly ways of determining that nowadays, such as with the built-in reporting functionality or something similar? |
|
Wouldn't it be better to return info about the handles in an array, and if anyone wants a count, they can get the array length, or count handles of a particular type or status in the array? |
|
Fwiw, @sam-github’s suggestion sounds very close to
|
|
Use case(s) would be helpful. You can get the handles via report: const handles = JSON.parse(process.report.getReport()).libuv
const count = Object.keys(handles).length - 1 // -1 accounts for synthetic `loop` type |
|
I think my proposed idea if "getActiveResources" covers this better. See #21453 (I would like to get back to that, but not quite sure when...) |
@XadillaX um, I am confused, does that have anything to do with either of my previous comments? EDIT: oh, right, I didn't include the word |
We may use the count to draw some health chart. |
|
I don't understand how a handle count has any bearing on process "health"? If anything, process "health" would be more a measure of things like event loop pauses, memory/cpu usage, etc. But anyway, it sounds like this would be better solved by the built-in process reporting feature instead. |
|
So shall I continue working for this PR? or any suggestions? |
|
@XadillaX I'm looking forward to this PR. @Fishrock123 probably had forgotten about his PR. |
|
I have not forgotten about mine, but some things have changed and I don't have any real reason to see it through. I still think this not the correct approach. |
If only I had known that before :P Okay, I'll work on yours then. It doesn't seem like there's much work to do. |
8ae28ff to
2935f72
Compare
|
This unfortunately has stalled out and has not seen any further activity. Closing but it can be reopened if it is picked back up again and rebased |
This method is to count libuv handles of current tick.
Checklist
make -j4 test(UNIX) passes