{"id":19837338,"url":"https://github.com/e-e-e/a-promise-queue","last_synced_at":"2025-05-01T18:30:37.162Z","repository":{"id":57171577,"uuid":"95214713","full_name":"e-e-e/a-promise-queue","owner":"e-e-e","description":"A native es6 promise queue with optional retry attempts.","archived":false,"fork":false,"pushed_at":"2018-06-23T05:47:23.000Z","size":13,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T12:18:02.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/e-e-e.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-23T11:38:14.000Z","updated_at":"2022-08-06T23:56:21.000Z","dependencies_parsed_at":"2022-08-24T14:42:24.915Z","dependency_job_id":null,"html_url":"https://github.com/e-e-e/a-promise-queue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fa-promise-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fa-promise-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fa-promise-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fa-promise-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e-e-e","download_url":"https://codeload.github.com/e-e-e/a-promise-queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251924590,"owners_count":21665998,"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":"2024-11-12T12:14:08.218Z","updated_at":"2025-05-01T18:30:36.821Z","avatar_url":"https://github.com/e-e-e.png","language":"JavaScript","readme":"# a promise queue\n\n[![Build Status](https://travis-ci.org/e-e-e/a-promise-queue.svg?branch=master)](https://travis-ci.org/e-e-e/a-promise-queue) [![Coverage Status](https://coveralls.io/repos/github/e-e-e/a-promise-queue/badge.svg?branch=master)](https://coveralls.io/github/e-e-e/a-promise-queue?branch=master)\n\nThis is just another promise queue. Simple.\n\n+ Native es6\n+ With concurrency\n+ Optional retry attempts for failed promises\n+ Option to use your favourite promise flavour (Bluebird, Q)\n\n## Install\n\nYou know this:\n```\nnpm install a-promise-queue --save\n```\n\n## Interface\n\n+ `queue = new PromiseQueue([options], [Function callback])`\n  Callback is fired whenever queue is emptied. If callback is not provided, queue will act as a promise which is resolved once queue is finished.\n  Options:\n  ```\n  {\n    promise: Promise, // the type of promises used. defaults to es6 native promises,\n    concurrency: Number // set the number of promises to run in parallel.\n  }\n  ```\n\n+ `queue.length`\n  Returns number of promises waiting to be executed.\n\n+ `var promise = queue.add(Function generator, [Object options])`\n  Returns a promise which is resolved or rejected when the promise produced by the generator is eventually resolved.\n  Example options:\n  ```js\n    {\n      attempts: number, // if promise fails it will retry this many times.\n      priority: number, // execution is ordered by priority default = 0.\n    }\n  ```\n\n+ `var promise = queue.flush()`\n  Runs all promises currently in the queue concurrently.\n  Returns a promise which is resolved when all promises are finished.\n  Any promises added after `.flush()` will execute after flush is complete.\n\n## Example:\n\n```js\nvar PromiseQueue = require('a-promise-queue');\n\nvar delay = (ms) =\u003e () =\u003e new Promise(resolve =\u003e setTimeout(resolve, ms));\n\nvar queue = new PromiseQueue(() =\u003e console.log('Queue is empty'));\nqueue.add(delay(100)).then(() =\u003e console.log('first this'));\nqueue.add(() =\u003e Promise.reject('then this fails')).catch((e) =\u003e console.log('Errored:', e));\nqueue.add(delay(10)).then(() =\u003e console.log('and this succeeds'));\nqueue.add(delay(10), { priority: 1 }).then(() =\u003e console.log('but not before this one jumps the queue.'));\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-e-e%2Fa-promise-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe-e-e%2Fa-promise-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-e-e%2Fa-promise-queue/lists"}