Skip to content

Instantly share code, notes, and snippets.

/a.js

Created January 19, 2017 10:03
Show Gist options
  • Save anonymous/0b8c3c5fbd2b5ce749541f96af2fefc1 to your computer and use it in GitHub Desktop.
Save anonymous/0b8c3c5fbd2b5ce749541f96af2fefc1 to your computer and use it in GitHub Desktop.
const genericPool = require('generic-pool');
const factory = {
create: function(){ return Promise.reject(new Error('cannot create resource'))}
,destroy: function () { return Promise.resolve() }
}
const opts = {
acquireTimeoutMillis: 1000
}
const myPool = genericPool.createPool(factory, opts)
myPool.acquire().then(function() {console.log('ok')}).catch((err)=>{console.log(err)})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment