{"_id":"poolr","_rev":"17-22c1d930e1a5e45f00d45357ac5f348c","name":"poolr","description":"limit parallel execution and serialze when limit is reached","dist-tags":{"latest":"0.0.9"},"versions":{"0.0.3":{"name":"poolr","version":"0.0.3","description":"limit parallel execution and serialze when limit is reached","homepage":"https://github.com/codingforce/poolr","repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"keywords":["pool","limit","parallel","async"],"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"dependencies":{},"main":"index","directories":{"lib":"./lib"},"scripts":{"test":"make test"},"engines":{"node":"0.4.x"},"_id":"poolr@0.0.3","_engineSupported":true,"_npmVersion":"0.3.15","_nodeVersion":"v0.5.0-pre","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"ebae74cca3b400422d08b0fbb48c7d1a1b56e83d","tarball":"https://registry.npmjs.org/poolr/-/poolr-0.0.3.tgz","integrity":"sha512-43doFc9P5foa5yF3IKuWrvtft7fUY0V6w4VvgwfTnn5txAwtJ1PPEpTopkXc/+DQur62D1XQnCRiwtSeLDq/SA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyMfNBk0WCzAJUOwlcVjsRCCJKRPhPsoACzIisltGpOwIgL1aSO90sbLPhB45t7fYHm8gqj3CJjFUOcVuyyxREunU="}]}},"0.0.4":{"name":"poolr","version":"0.0.4","description":"limit parallel execution and serialze when limit is reached","homepage":"https://github.com/codingforce/poolr","repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"keywords":["pool","limit","parallel","async"],"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"dependencies":{},"main":"index","directories":{"lib":"./lib"},"scripts":{"test":"make test"},"engines":{"node":"0.4.x"},"_id":"poolr@0.0.4","_engineSupported":true,"_npmVersion":"1.0.0-0-rc","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"a2f9667d763f96ce874592a675183c6fadac7651","tarball":"https://registry.npmjs.org/poolr/-/poolr-0.0.4.tgz","integrity":"sha512-DbL3rfo4cRbh7DBLrrkekVtb6njE4Coonsi07mmQIG1ZZt2/vQBXbdQg7EReenOSIWMM06K4C+/kwxCU1qn+7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB0nd49KCmri8KkrrYK0C8ECleQzkeSIZLOfzx+IQ3fGAiBbeZda9I8/H4MgHxVfOscD8GF9e2rix8GTH0+QCnQVPA=="}]}},"0.0.5":{"name":"poolr","version":"0.0.5","description":"limit parallel execution and serialze when limit is reached","homepage":"https://github.com/codingforce/poolr","repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"keywords":["pool","limit","parallel","async"],"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"dependencies":{},"devDependencies":{"mocha":"0.2.x","should":"0.3.x"},"main":"index","directories":{"lib":"./lib"},"scripts":{"test":"make test"},"engines":{"node":">= 0.4.x < 0.7.0"},"_npmUser":{"name":"bkw","email":"bkw@codingforce.com"},"_id":"poolr@0.0.5","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.4","_defaultsLoaded":true,"dist":{"shasum":"bf68a4fc25fa96d877ec6df9f8b5d5dcba531b20","tarball":"https://registry.npmjs.org/poolr/-/poolr-0.0.5.tgz","integrity":"sha512-RdWi3vPjvR29bWMrgH6yPpq+M7o9VNIzSMiewvXMvIsRSW23EqYbVkahQALAopIlGBDdl2CUoMx6RIaiW4x0qA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH7zg34KBuLz9joGLWncXHLsNHupB8fWGSPlChQHFxc8AiEAw8W7Rf/asi25xV/6eX1Lqnuk9ZNy8hW8Dkt1OjMpOtk="}]},"maintainers":[{"name":"bkw","email":"bkw@codingforce.com"}]},"0.0.6":{"name":"poolr","version":"0.0.6","description":"limit parallel execution and serialze when limit is reached","homepage":"https://github.com/codingforce/poolr","repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"keywords":["pool","limit","parallel","async"],"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"contributors":[{"name":"Seth LaForge"}],"dependencies":{},"devDependencies":{"mocha":"0.2.x","should":"0.3.x"},"main":"index","directories":{"lib":"./lib"},"scripts":{"test":"make test"},"engines":{"node":">= 0.4.x < 0.7.0"},"_npmUser":{"name":"bkw","email":"bkw@codingforce.com"},"_id":"poolr@0.0.6","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.4","_defaultsLoaded":true,"dist":{"shasum":"4112ebe6fc6847ca2adab7a251d2a68c4b182d3d","tarball":"https://registry.npmjs.org/poolr/-/poolr-0.0.6.tgz","integrity":"sha512-d9puiOnioqvEShJGNom0crN7l07+OJsc5kAo6iu/NxVidrncDTHYgHVZWAp5OtzNMlZ3HXOOziDF2LD+YMuzaw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCjhVx/jkcaj5F+T01zjoGgxPwgaa2+bajtEbN4NM6UkwIhALK/ezzuUPcBM5JdkcVy9mQskUQqMWVKBJTszWGNAD3O"}]},"maintainers":[{"name":"bkw","email":"bkw@codingforce.com"}]},"0.0.7":{"name":"poolr","version":"0.0.7","description":"limit parallel execution and serialze when limit is reached","homepage":"https://github.com/codingforce/poolr","repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"keywords":["pool","limit","parallel","async"],"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"contributors":[{"name":"Seth LaForge"}],"dependencies":{},"devDependencies":{"mocha":"0.2.x","should":"0.3.x"},"main":"index","directories":{"lib":"./lib"},"scripts":{"test":"make test"},"engines":{"node":">= 0.4.x < 0.7.0"},"_npmUser":{"name":"bkw","email":"bkw@codingforce.com"},"_id":"poolr@0.0.7","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.2","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"dbf64144319f4cfc34081e9efc9cb254f01aced8","tarball":"https://registry.npmjs.org/poolr/-/poolr-0.0.7.tgz","integrity":"sha512-NUjVmgEGFftQX01ogI5Nid+op1IBuuvc1YpgNf5oJ8dG4hurPIEF7IuzyJt4tr34K9mYNPwc9NLKwBn8xakePw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCJbquFJbCoumejrKSILrt+X87xnMOXkD1wE4LEICwgUQIhAPscNEcizIUJJvpbbRaX5oULjrbulNhCMVZZ/4Jd8315"}]},"maintainers":[{"name":"bkw","email":"bkw@codingforce.com"}]},"0.0.9":{"name":"poolr","version":"0.0.9","description":"limit parallel execution and serialze when limit is reached","homepage":"https://github.com/codingforce/poolr","repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"keywords":["pool","limit","parallel","async"],"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"contributors":[{"name":"Seth LaForge"}],"dependencies":{},"devDependencies":{"mocha":"1.6.x","should":"1.2.x"},"main":"index","directories":{"lib":"./lib"},"scripts":{"test":"make test"},"engines":{"node":">= 0.8"},"_id":"poolr@0.0.9","dist":{"shasum":"2ac37be02f03fb5e489188eca887f3d6181d1e20","tarball":"https://registry.npmjs.org/poolr/-/poolr-0.0.9.tgz","integrity":"sha512-ffNnsOIPeiwb07BoNyBEmeBrMkNfFSIZC8LmeWDi4TzRDHu/LzHVZdsvJg8Cqlfh0vBI1rgetPj3VoiiMqz35w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCodfewJ4L+YHz87/DQccYtj14HOmZTQUpGta3uaK5ItgIhAPTkZrDwDpwBUhJleeOxaGDvUHLrbUOUSXllbKp9qiKT"}]},"_npmVersion":"1.1.61","_npmUser":{"name":"bkw","email":"bkw@codingforce.com"},"maintainers":[{"name":"bkw","email":"bkw@codingforce.com"}]}},"maintainers":[{"name":"bkw","email":"bkw@codingforce.com"}],"time":{"modified":"2022-06-24T08:13:27.368Z","created":"2011-03-20T13:06:11.770Z","0.0.3":"2011-03-20T13:06:12.325Z","0.0.4":"2011-04-29T08:34:19.554Z","0.0.5":"2011-12-04T13:20:22.098Z","0.0.6":"2011-12-04T15:14:13.930Z","0.0.7":"2012-03-14T13:08:40.543Z","0.0.9":"2012-10-16T16:26:51.865Z"},"author":{"name":"Bernhard Weisshuhn","email":"bkw@codingforce.com","url":"https://github.com/bkw"},"repository":{"type":"git","url":"git://github.com/codingforce/poolr.git"},"users":{"fgribreau":true,"parkerproject":true},"homepage":"https://github.com/codingforce/poolr","keywords":["pool","limit","parallel","async"],"contributors":[{"name":"Seth LaForge"}],"readme":"[![Build Status](https://secure.travis-ci.org/codingforce/poolr.png)](http://travis-ci.org/codingforce/poolr)\n\n# poolr.js\n\n  Small but usefull resource pooling/limiting/throttling library for node.js.\n\n  Poolr runs asyncronous tasks in parallel until a configured limit is\n  reached and then switches to serial execution.\n  This helps maximizing the use of limited resources like filedescriptors\n  or remote (database-) connections.\n\n  poolr tries to be small and intuitive to use. For a much more advanced\n  implementation of resource pools take a look at\n  [node-pool](https://github.com/coopernurse/node-pool).\n  If you only want to pool http request, take a look at node's\n  builtin [http.Agent.maxSockets](http://nodejs.org/docs/v0.4.0/api/http.html#agent.maxSockets).\n\n  You can add any function you like to a pool:\n\n  `staticFunc(foo, bar, callback)` becomes:\n  `thisPool.addTask(staticFunc, foo, bar, callback);`\n\n  For object methods you can either pass the object as a default context as a\n  second argument to the constructor of poolr, or use function binding:\n\n    var someObj = new someClass();\n    var thisPool = poolr.createPool(10, someObj);\n    thisPool.addTask(someObj.someMethod, arg1, argN, callback);\n\n  or:\n\n    var someObj = new someClass();\n    var thisPool = poolr.createPool(10);\n    thisPool.addTask(someObj.someMethod.bind(someObj), arg1, argN, callback);\n\n  \n  If you only need one pool, you can just create it during require:\n\n    var myPool = require('poolr').createPool(10);\n\n## Synopsis\n\nA basic example limiting cradle connections to two at a time:\n\n    var cradle = require('cradle'),\n        poolr  = require('poolr').createPool;\n\n    cradle.setup({host: 'localhost', port: 5984});\n    var conn      = new (cradle.Connection)(),\n        db        = conn.database('test'),\n        couchPool = poolr(2, db);\n\n    // all cradle functions are called via the pool:\n    couchPool.addTask(db.exists, function(err, result) {\n        if (err) throw err;\n            console.log(result + ' exists');\n        }\n    });\n    couchPool.addTask(db.save, {foo:'bar'}, function(err, res) {\n        if (err) throw err;\n        console.log(res);\n    });\n    // ...and so on.\n    // Add more as fast as you like. Only two functions will be run at a time\n\n\n## createPool\n\n`createPool()` ceates a new reource pool. The constructor takes one integer\nargument representing the maximum number of tasks allowed for using this\nresource in parallel.\nIf you want to support a default context for binding functions to, you can\nsupply it as a second argument.\n\n  `poolr.createPool(5);` creates a resource pool for 5 parallel exections\n  `poolr.createPool(5, someObj);` creates a resource pool for 5 parallel\n  executions with `someObj` as `this` context for tasks.\n\n\n## addTask()\n\nadd a task to the resource pool. Takes the function to be called as the\nfirst argument. Later arguments are passed to the function.\nThe last argument is expected to be a callback to pass back the results.\nIf the function is an object method and needs its object context, you\nshould either supply the object as a second argument to the poolr constructor\nor bind the method to its object:\n\n    var obj = new someClass();\n    myPool = poolr.createPool(10, obj);\n\n    addTask(staticFunction, arg1, argn, callback);\n\n    addTask(otherObj.someFunction.bind(otherObj), arg1, argn, callback);\n\n    myPool.addTask(obj.someFunction, arg1, argn, callback);\n\naddTask() returns `true` if the task is run immediately and `false` if\nit will be run within the next free slot.\n\n## Events\n\n### throttle\n\npoolr will emit `throttle` when the limit is reached and tasks are being\nqueued.\n\n### drain\n\npoolr will emit `drain` as soon as there are free slots in the task queue\nagain.\n\n### last\n\npoolr will emit `last` after the last task in the queue has been started.\n\n### idle\n\npoolr will emit `idle` after the last task in the queue has finished.\n\n## Legal Stuff\n\nNode.js is an official trademark of Joyent. This module is not formally\nrelated to or endorsed by the official Joyent Node.js open source or\ncommercial project.\n\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Bernhard Weisshuhn <bkw@codingforce.com>\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","readmeFilename":""}