coopernurse / node-pool

Generic resource pooling for node.js
2.37k stars 259 forks source link

Attempt to fix defaultEvictor. #254

Open scream314 opened 5 years ago

scream314 commented 5 years ago

If pooledResource is not a Resource (but an Error), it won't have lastIdleTime thus all ifs are returning false meaning the Resource (which is already broken in some way) won't get evicted ever, they stay in the pool and this may result in a ResourceRequest Timed Out error (b/c all slots are occupied by stuck Resources). As a solution, idleTime is checked, and if it is falsy, the Resource gets evicted.

Signed-off-by: Daniel Schopper scream314@gmail.com

scream314 commented 5 years ago

Please someone shed some light how to interpret the eslint errors in the Travis build log, I cannot figure out, what the problem is.

sandfox commented 5 years ago

npm run lint or yarn run lint should fix up the formatting errors which travis is complaining about.

scream314 commented 5 years ago

This is definitely not good as it is, the added JSON.stringify produces a TypeError: Converting circular structure to JSON. Currently I am testing it with util.inspect instead.

wadeDra commented 5 years ago

I have reported ResourceRequest Timed Out here. I would like to ask what causes” pooledResource is not a Resource (but an Error)“ @scream314

scream314 commented 4 years ago

Sorry, I cannot work on this anymore. Maybe @steveetm?