{"id":17683229,"url":"https://github.com/waldemarnt/concurrent-promises","last_synced_at":"2025-03-30T19:49:26.337Z","repository":{"id":57205224,"uuid":"93528822","full_name":"waldemarnt/concurrent-promises","owner":"waldemarnt","description":"This package allows safe promise concurrency ","archived":false,"fork":false,"pushed_at":"2017-06-09T14:45:05.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T01:26:18.241Z","etag":null,"topics":["concurrency","concurrent-programming","limit","promise","promises","promises-concurrent"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waldemarnt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-06T14:39:11.000Z","updated_at":"2017-06-09T14:37:58.000Z","dependencies_parsed_at":"2022-09-12T22:50:36.653Z","dependency_job_id":null,"html_url":"https://github.com/waldemarnt/concurrent-promises","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldemarnt%2Fconcurrent-promises","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldemarnt%2Fconcurrent-promises/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldemarnt%2Fconcurrent-promises/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waldemarnt%2Fconcurrent-promises/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waldemarnt","download_url":"https://codeload.github.com/waldemarnt/concurrent-promises/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246372501,"owners_count":20766627,"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":["concurrency","concurrent-programming","limit","promise","promises","promises-concurrent"],"created_at":"2024-10-24T09:44:44.213Z","updated_at":"2025-03-30T19:49:26.313Z","avatar_url":"https://github.com/waldemarnt.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Concurrent-promises\n[![Build Status](https://travis-ci.org/waldemarnt/concurrent-promises.svg?branch=master)](https://travis-ci.org/waldemarnt/concurrent-promises)\n\nSometimes we want to limit the number of concurrent promises like in HTTP requests or I/O. This library allows limit the number of concorrency.\nDifferent from libraries like: https://github.com/timdp/es6-promise-pool it allows retries and total control over the concurrency flow.\n\n# Example\n\nThe example below showns how this lib works. You will need a resolver which is the function that will called recursively by concurrentPromises and the number of concurrent promises that will run (default is 8).\n\nIn this case are created 10 promises that are resolved in a different time to simulate an assincronous I/O.\nTo finish the conrrentPromises caller you should return *null*;\n\n```javascript\n    it('should limit of concurrent requests', () =\u003e {\n      let count = 0;\n      const resolver = () =\u003e {\n        return new Promise(resolve =\u003e {\n          if(count \u003c 10) {\n            count++;\n            return setTimeout(() =\u003e {\n              resolve(true);\n            }, Math.floor((Math.random() * 1000) + 1));\n          }\n          return resolve(null);\n        });\n      };\n\n      const concurrentPromises = new ConcurrentPromises({resolver, concurrency: 3});\n\n      return concurrentPromises.begin()\n        .then(result =\u003e {\n          expect(result.length).to.be.eql(10);\n        });\n    });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaldemarnt%2Fconcurrent-promises","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaldemarnt%2Fconcurrent-promises","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaldemarnt%2Fconcurrent-promises/lists"}