Gathering detailed insights and metrics for make-concurrent
Gathering detailed insights and metrics for make-concurrent
Gathering detailed insights and metrics for make-concurrent
Gathering detailed insights and metrics for make-concurrent
best-effort-concurrent-cache
Make a best effort to offer a simple filesystem-based cache for concurrent access from multiple processes.
axios-concurrency
Gives easy control of how many requests an axios instance makes concurrently. Useful for dealing with rate limiting. Implemented using interceptors.
@hamed.motallebi/concurrent-tasks
Make a task queue to run specified number of tasks concurrently at the same time.
@xarc/run
concurrent or serial run npm scripts, javascript tasks, and more
npm install make-concurrent
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
53 Commits
2 Forks
3 Watchers
1 Branches
3 Contributors
Updated on Mar 04, 2023
Latest Version
5.4.0
Package Id
make-concurrent@5.4.0
Unpacked Size
7.79 kB
Size
3.45 kB
File Count
5
NPM Version
8.1.0
Node Version
16.13.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
make-concurrent
is a function which create function with limited parallel execution of passed function according with passed concurrency
option (1
by default).
It's not replacement of lodash.debounce / lodash.throttle. Created function called immediately if current executed functions not excess concurrency
option, otherwise call will be blocked until previous called functions not finished.
make-concurrent
functions does not make any sense for synchronous functions, because JS can not execute more than 1 same synchronous function at one time, it's can be useful only for async functions.
Callbacks are not supported, async functions with us from Node v7.6.0 (2017-02-22), please use it.
npm:
1npm install https://github.com/fanatid/make-concurrent
yarn:
1yarn add https://github.com/fanatid/make-concurrent
By default npm
/ yarn
will install code from master
branch. If you want specified version, just add some branch name / commit hash / tag and the end of URL. See Yarn add or npm install for details about installing package from git repo.
Anywhere where you need limited access to some resource.
When we call function created by make-concurrent
counter of called functions increased by 1
, then increased counter compared with concurrency
option, if counter is greater than concurrency
then we create Promise
, push resolve
function to queue (FIFO) and wait while this Promise
will be resolved, before call original function. When execution of original function will be finished we decrease counter on 1
and check queue, if queue length is not zero we take first item and call it, which resolve Promise
and original function will be called again.
All code is less than 50 lines, just check it. This will take 2 minutes, but will give better understanding how make-concurrent
works and how can be used effectively.
Assume you need make requests to some API, but this API have limit of simultaneous requests by API key.
1const makeConcurrent = require('make-concurrent') 2const fetch = require('node-fetch') 3 4async function request (user) { 5 return fetch(`https://example.org/getinfo?user=${user}&apikey=${process.env.API_KEY}`) 6} 7 8module.exports = makeConcurrent(request, { concurrency: 3 })
Now only 3 request
function will work at one moment.
Sometimes we have state and need work with it from async functions which can be executed at one time.
1const makeConcurrent = require('make-concurrent') 2 3const state = {} 4async function unsafeUpdate (user) { 5 const currentValue = state[user] === undefined ? 0 : state[user] 6 const newValue = await getNewValue(user, currentValue) 7 state[user] = newValue 8} 9 10const safeUpdate = makeConcurrent(unsafeChange) 11// safeUpdate('alice')
While safeUpdate
going to be safe function for working with state
, it's good as general approach. But here state changed for specified user, so we can use the .byArguments()
method:
1const makeConcurrent = require('make-concurrent') 2 3const state = {} 4async function unsafeUpdate (user) { 5 const currentValue = state[user] === undefined ? 0 : state[user] 6 const newValue = await getNewValue(user, currentValue) 7 state[user] = newValue 8} 9 10const safeUpdate = makeConcurrent.byArguments(unsafeUpdate) 11// safeUpdate('alice')
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 3/29 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More