You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Errmmm maybe :-) (the docs probably aren't at all clear here)
The evictor itself only gets "started" when the pool is started, so if you create a pool with autostart: false the evictor will do nothing until you call pool.start()
Just to clarify what you are seeing?
you creating the pool with autostart: false
then calling pool.start()
the evictor is never getting called despite the pool having been started?
This behavior confused me as well. Documentation for autostart states
should the pool start creating resources etc once the constructor is called
I have expected autostart to only affect the behavior of creating initial resources to satisfy the min option. There should be a mention that the pool must be started manually for eviction to work. Right now, there is no mention about the pool.start() method in the docs at all.
@patriksimek Yeah, the docs could be clearer here, and the evictor start behaviour is definitely in the undefined/implicit category. What problems did this cause you, or how did you discover this? You probably have a use case I haven't considered and would be good to make sure I cover it properly.
@sandfox It started with a finding, that after updating to v3, idle connections was not closed automatically. So after a few minutes, I have discovered that the library no longer uses reapIntervalMillis (which was on by default) and uses evictionRunIntervalMillis instead (which is off by default). There is no mention about this change in migration guide by the way.
But, even setting a positive value in evictionRunIntervalMillis did not helped. So, after another few minutes of looking to the node-pool source code, I have discovered that eviction requires start method to be called. And start method requires autostart to be turned on (I had it turned off).
This is how I get there. My expectation was, that with autostart turned off, the pool opens up resources gradually as they're created and destroy them only when the number of open resources reaches min value.
Anyway, great work, I'm using this lib in node-mssql for a years without any problems.
thanks for the quick response! it now makes sense to me (at least without looking at the code), I'll see what I come up with and some documentation fixes
Activity
sandfox commentedon Jan 8, 2017
Errmmm maybe :-) (the docs probably aren't at all clear here)
The evictor itself only gets "started" when the pool is started, so if you create a pool with
autostart: falsethe evictor will do nothing until you callpool.start()Just to clarify what you are seeing?
autostart: falsepool.start()patriksimek commentedon Apr 25, 2017
This behavior confused me as well. Documentation for
autostartstatesI have expected
autostartto only affect the behavior of creating initial resources to satisfy theminoption. There should be a mention that the pool must be started manually for eviction to work. Right now, there is no mention about thepool.start()method in the docs at all.sandfox commentedon Apr 26, 2017
@patriksimek Yeah, the docs could be clearer here, and the evictor start behaviour is definitely in the undefined/implicit category. What problems did this cause you, or how did you discover this? You probably have a use case I haven't considered and would be good to make sure I cover it properly.
patriksimek commentedon Apr 26, 2017
@sandfox It started with a finding, that after updating to v3, idle connections was not closed automatically. So after a few minutes, I have discovered that the library no longer uses
reapIntervalMillis(which was on by default) and usesevictionRunIntervalMillisinstead (which is off by default). There is no mention about this change in migration guide by the way.But, even setting a positive value in
evictionRunIntervalMillisdid not helped. So, after another few minutes of looking to the node-pool source code, I have discovered that eviction requiresstartmethod to be called. Andstartmethod requiresautostartto be turned on (I had it turned off).This is how I get there. My expectation was, that with
autostartturned off, the pool opens up resources gradually as they're created and destroy them only when the number of open resources reachesminvalue.Anyway, great work, I'm using this lib in node-mssql for a years without any problems.
sandfox commentedon Apr 26, 2017
thanks for the quick response! it now makes sense to me (at least without looking at the code), I'll see what I come up with and some documentation fixes