{"id":28076714,"url":"https://github.com/jaredhanson/node-functionpool","last_synced_at":"2025-05-13T01:47:43.941Z","repository":{"id":66002063,"uuid":"1423471","full_name":"jaredhanson/node-functionpool","owner":"jaredhanson","description":"Provides a pool of functions that can be used to execute tasks in Node.js.","archived":false,"fork":false,"pushed_at":"2014-03-14T22:44:46.000Z","size":323,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T01:47:37.271Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaredhanson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-02-28T21:47:44.000Z","updated_at":"2021-08-07T14:42:00.000Z","dependencies_parsed_at":"2023-02-19T21:15:31.044Z","dependency_job_id":null,"html_url":"https://github.com/jaredhanson/node-functionpool","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fnode-functionpool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fnode-functionpool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fnode-functionpool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredhanson%2Fnode-functionpool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredhanson","download_url":"https://codeload.github.com/jaredhanson/node-functionpool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253856615,"owners_count":21974576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-13T01:47:43.470Z","updated_at":"2025-05-13T01:47:43.925Z","avatar_url":"https://github.com/jaredhanson.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Function Pool\n\nFunction Pool provides a fixed-size pool that can be used to execute potentially\nexpensive tasks in Node.js.\n\nConceptually similar to a [thread pool](http://en.wikipedia.org/wiki/Thread_pool_pattern),\nbut adapted to Node's single-threaded model, Function Pool organizes tasks into\na queue, which will be executed by a limited number of workers.  The number of\nworkers corresponds to the number of tasks that will be allowed to execute\nconcurrently.  After the limit has been reached, tasks will be queued and\nexecuted when prior tasks complete.\n\n## Installation\n\n    $ npm install functionpool\n    \n## Usage\n\n#### Allocate a Pool\n\nCreate a new pool, specifying the maximum number of workers in the `size`\noption.  The worker function must accept a `done` callback, which it must\ncall with the result when it completes work (or error, if an exception occurs).\n\n    var pool = new functionpool.Pool({ size: 4 }, function(x, y, done) {\n      setTimeout(function() { done(null, x + y) }, 5000);\n    });\n\n#### Add Tasks to the Pool\n\nAdd tasks to the pool, which will be executed if workers are available and\nqueued for later execution otherwise.\n\n    pool.task(3, 14, function(err, res) {\n      console.log('3 + 14 = ' + res);\n    });\n\n## Tests\n\n    $ npm install --dev\n    $ make test\n\n## Credits\n\n  - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Jared Hanson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Fnode-functionpool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredhanson%2Fnode-functionpool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredhanson%2Fnode-functionpool/lists"}