node-pool icon indicating copy to clipboard operation
node-pool copied to clipboard

add "reset" method

Open gkorland opened this issue 11 years ago • 1 comments

"reset" method that can be overridden is a very important addition that will let a "resting" a resource before putting it back to the pool. The resource shouldn't be available until it was "rested" and should be released on err.

var poolModule = require('generic-pool');
var pool = poolModule.Pool({

    reset: function(resource, done) { 
          resource.clean(function(err){}{ 
             done(err);
          });
    }

}

gkorland avatar Aug 31 '14 14:08 gkorland

Any update on this? Need to run some code after a resource is released to basically "clean" it before it is used again.

fbtariq avatar Mar 22 '23 18:03 fbtariq