-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathp-limit.node.txt
19 lines (15 loc) · 1.01 KB
/
p-limit.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
┏━━━━━━━━━━━━━┓
┃ P-LIMIT ┃
┗━━━━━━━━━━━━━┛
VERSION ==> #6.2.0
P-LIMIT(NUM) #Returns FUNC() throttled to only run NUM times at once.
->FUNC(FUNC2, ...ARGS)->> #FUNC(FUNC2, ...ARGS) forwards FUNC2(...ARGS):
# - async even if FUNC2 is sync
# - FUNC2 and ...ARGS can be different each time FUNC() is called
#Additional calls are queued, not dropped.
FUNC.concurrency #NUM passed to P-LIMIT()
FUNC.activeCount #NUM currently running
FUNC.pendingCount #NUM waiting to run
FUNC.clearQueue() #Removes any FUNC2 currently waiting to run
limitFunction(FUNC2, OPTS)
->FUNC(...ARGS)->> #Same as P-LIMIT(OPTS.concurrency) with bound FUNC2