Comments (8)
hey there,
Yep, try using pool.destroy(obj) instead of pool.release(obj) - destroy()
will decrement the usage count on the resource and call
factory.destroy(obj) so you can attempt to close it.
does that help?
-- James
On Thu, Feb 2, 2012 at 11:30 AM, Mark Cavage <
[email protected]
wrote:
Hi,
Great module - I didn't see it from briefly scanning your code: it's
pretty common that with various drivers (especially stateful/long-lived
ones), I'd want to have the pool auto-purge a client that emits an error
event, so it can recreate another one to replace it. Is there a way to do
that?Thanks!
~Mark
Reply to this email directly or view it on GitHub:
#31
James Cooper
http://blog.bitmechanic.com/
from node-pool.
Oh ok - so just do it "outside" of the pool. I was asking if pool could just manage this automatically (that would be a nice new feature).
from node-pool.
ah.. yeah, I guess I'm open to it. Feel free to propose a design. Are
you asking for the pool to do a health check on acquire and/or release? Or
some other way?
-- James
On Thu, Feb 2, 2012 at 11:48 AM, Mark Cavage <
[email protected]
wrote:
Oh ok - so just do it "outside" of the pool. I was asking if pool could
just manage this automatically (that would be a nice new feature).
Reply to this email directly or view it on GitHub:
#31 (comment)
James Cooper
http://blog.bitmechanic.com/
from node-pool.
Well, I guess we could do that too (health check on acquire). I was actually thinking more of .on('error') it could go into a "destroy -> create". I dunno, maybe it's not worth it if it's wrapped outside of the pool. Because either way (health check or error-based), it does feel like you'd have to do retry/backoff, otherwise you could end up in a "spin" when the backend resource is out.
from node-pool.
right, exactly. .on(error) seems similar to .destroy(obj) -- in either
case factory.create() will get called if all pool objects are in use.
DBCP for Java has health check hooks, so I'd be open to adding something
like that. In particular you could have removeIdle() execute the health
check hook on the factory (if defined).. Would that be useful for you? or
is that unrelated to your use case?
-- James
On Thu, Feb 2, 2012 at 11:54 AM, Mark Cavage <
[email protected]
wrote:
Well, I guess we could do that too (health check on acquire). I was
actually thinking more of .on('error') it could go into a "destroy ->
create". I dunno, maybe it's not worth it if it's wrapped outside of the
pool. Because either way (health check or error-based), it does feel like
you'd have to do retry/backoff, otherwise you could end up in a "spin" when
the backend resource is out.
Reply to this email directly or view it on GitHub:
#31 (comment)
James Cooper
http://blog.bitmechanic.com/
from node-pool.
Yeah I think a health check hook like jakarta's that's executed outside of my normal code flows would actually get me the same thing - so sold :)
from node-pool.
Sweet. I'll keep this issue open as a placeholder. swamped a bit at the
moment
On Thu, Feb 2, 2012 at 12:53 PM, Mark Cavage <
[email protected]
wrote:
Yeah I think a health check hook like jakarta's that's executed outside of
my normal code flows would actually get me the same thing - so sold :)
Reply to this email directly or view it on GitHub:
#31 (comment)
James Cooper
http://blog.bitmechanic.com/
from node-pool.
Going to close due to age reasons. Feel free to re-open if this issue is still relevant anyone.
from node-pool.
Related Issues (20)
- Cuncurrent problem with net socket data event
- Issue after upgrading generic-pool from 2.4.2 to 3.7.1
- Im not getting any performance using a pool connection vs reusing one connection
- waitingClientsCount function has disappeared HOT 1
- resource release not getting called HOT 2
- NPM installation faliure HOT 2
- Add param to factory
- Feature: add pool.use method. HOT 1
- Borrowed resources never go higher than 1 HOT 2
- Share pool between servers in a cluster HOT 3
- How to work maxWaitingClients? HOT 1
- Add destroy timeout to prevent pool.clear from hanging when destroy promise never resolves HOT 4
- testOnReturn = no-op?
- What does happen if I don't release the resource and close the node? HOT 2
- Resource not currently part of this pool HOT 1
- `ready` method from Pool is missing from the TS definitions (v3.8.2)
- .use does not handle synchronous work functions
- Consistently occuring `ResourceRequest timed out` Error HOT 1
- TimeoutError: ResourceRequest timed out HOT 2
- Suggested Feature: borrowTimeoutMillis HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-pool.