{"id":15731463,"url":"https://github.com/chrisvxd/qler","last_synced_at":"2025-03-13T04:31:03.621Z","repository":{"id":3544931,"uuid":"50100402","full_name":"chrisvxd/Qler","owner":"chrisvxd","description":"Excruciatingly simple synchronous queuing for node","archived":false,"fork":false,"pushed_at":"2023-10-03T01:17:37.000Z","size":597,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T18:24:39.738Z","etag":null,"topics":["async","asynchronous","concurrency","javascript","nodejs","queue","queueing","queues"],"latest_commit_sha":null,"homepage":null,"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/chrisvxd.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-21T10:33:49.000Z","updated_at":"2023-04-25T10:26:31.000Z","dependencies_parsed_at":"2024-06-23T03:33:56.144Z","dependency_job_id":null,"html_url":"https://github.com/chrisvxd/Qler","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisvxd%2FQler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisvxd%2FQler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisvxd%2FQler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisvxd%2FQler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisvxd","download_url":"https://codeload.github.com/chrisvxd/Qler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243341406,"owners_count":20275866,"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":["async","asynchronous","concurrency","javascript","nodejs","queue","queueing","queues"],"created_at":"2024-10-04T00:01:46.408Z","updated_at":"2025-03-13T04:31:03.240Z","avatar_url":"https://github.com/chrisvxd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Qler\n\n[![NPM](https://img.shields.io/npm/v/qler.svg)](https://www.npmjs.com/package/qler) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-prettier-brightgreen.svg)](https://prettier.io)\n\nExcruciatingly simple synchronous queuing for node, with concurrency support. It provides similar functionality to [`p-queue`](https://github.com/sindresorhus/p-queue), with the ability to lock concurrency based on a key.\n\nUsed in production at https://wellpaid.io.\n\n## Installation\n\n```sh\nnpm install qler\n## or\nyarn add qler\n```\n\n## API\n\n- `queue(fn, key)` - queue a promise that returns a promise. Will never run two fns with the same key.\n- `cancel()` - will cancel all remaining queue items and reject any remaining queue promises.\n- `wait()` - wait for all previously queued promises to complete. Returns a promise.\n\n## Usage\n\n### Basic\n\nExecute two functions in sequence, without blocking main thread.\n\n```js\nimport Qler from \"qler\";\n\nconst myQueue = Qler();\n\nmyQueue\n  .queue(async () =\u003e await sleep(2)) // Wait for 2 seconds\n  .then(() =\u003e console.log(`Function 1 executed after 2 seconds!`));\n\nmyQueue\n  .queue(async () =\u003e await sleep(2)) // Wait for 2 seconds\n  .then(() =\u003e console.log(`Function 2 executed after 4 seconds!`));\n```\n\n### With concurrency\n\n```js\nimport Qler from \"qler\";\n\nconst myQueue = Qler(2);\n\nmyQueue\n  .queue(async () =\u003e await sleep(2)) // Wait for 2 seconds\n  .then(() =\u003e console.log(`Function 1 executed after 2 seconds!`));\n\nmyQueue\n  .queue(async () =\u003e await sleep(2)) // Wait for 2 seconds\n  .then(() =\u003e console.log(`Function 2 executed after 2 seconds!`));\n\nmyQueue\n  .queue(async () =\u003e await sleep(2)) // Wait for 2 seconds\n  .then(() =\u003e console.log(`Function 3 executed after 4 seconds!`));\n```\n\n### With keyed concurrency\n\nKeyed concurrency allows you to limit concurrency to certain function calls. If two or more queued function calls share the same key, they won't be run concurrently.\n\n```js\nimport Qler from \"qler\";\n\nconst myQueue = Qler(2);\n\nmyQueue\n  .queue(async () =\u003e await sleep(2), \"foo\") // Wait for 2 seconds and key on 'foo'\n  .then(() =\u003e console.log(`Function 1 executed after 2 seconds!`));\n\nmyQueue\n  .queue(async () =\u003e await sleep(2), \"foo\") // Wait for 2 seconds and key on 'foo'\n  .then(() =\u003e console.log(`Function 2 executed after 4 seconds!`));\n\nmyQueue\n  .queue(async () =\u003e await sleep(2), \"bar\") // Wait for 2 seconds and key on 'bar'\n  .then(() =\u003e console.log(`Function 3 executed after 2 seconds!`));\n```\n\n## License\n\nMIT © [Chris Villa](http://www.chrisvilla.co.uk)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisvxd%2Fqler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisvxd%2Fqler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisvxd%2Fqler/lists"}