Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/sindresorhus/p-queue
/ functions
Functions
73 in github.com/sindresorhus/p-queue
⨍
Functions
73
◇
Types & classes
4
↓ 434 callers
Method
add
(function_: Task<TaskResultType>, options: Partial<EnqueueOptionsType> = {})
source/index.ts:444
↓ 77 callers
Method
onIdle
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is emp
source/index.ts:682
↓ 31 callers
Method
dequeue
()
source/priority-queue.ts:82
↓ 26 callers
Method
enqueue
(run: RunFunction, options?: Partial<PriorityQueueOptions>)
source/priority-queue.ts:17
↓ 25 callers
Method
start
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or b
source/index.ts:595
↓ 23 callers
Function
createRun
(value: string)
test/priority-queue.ts:5
↓ 19 callers
Method
clear
Clear the queue.
source/index.ts:616
↓ 16 callers
Method
onPendingZero
The difference with `.onIdle` is that `.onPendingZero` only waits for currently running tasks to finish, ignoring queued tasks. @returns A promise t
source/index.ts:696
↓ 14 callers
Method
pause
Put queue execution on hold.
source/index.ts:609
↓ 13 callers
Method
onEmpty
Can be called multiple times. Useful if you for example add additional items at a later time. @returns A promise that settles when the queue becomes
source/index.ts:652
↓ 13 callers
Method
setPriority
Updates the priority of a promise function by its id, affecting its execution order. Requires a defined concurrency limit to take effect. For exampl
source/index.ts:432
↓ 9 callers
Method
onRateLimit
@returns A promise that settles when the queue becomes rate-limited due to intervalCap.
source/index.ts:707
↓ 8 callers
Function
assertSlidingWindow
(executionTimes: number[], interval: number, intervalCap: number, jitterMilliseconds = Math.min(25, Math.trunc
test/strict.ts:6
↓ 8 callers
Method
filter
(options: Readonly<Partial<PriorityQueueOptions>>)
source/priority-queue.ts:102
↓ 7 callers
Method
onError
()
source/index.ts:756
↓ 6 callers
Method
#onEvent
(event: EventName, filter?: () => boolean)
source/index.ts:767
↓ 6 callers
Method
remove
(idOrRun: string | RunFunction)
source/priority-queue.ts:63
↓ 5 callers
Method
#scheduleRateLimitUpdate
()
source/index.ts:832
↓ 5 callers
Method
addAll
( functions: ReadonlyArray<Task<TaskResultsType>>, options?: Partial<EnqueueOptionsType>, )
source/index.ts:585
↓ 5 callers
Function
addBenchmark
(name: string, fn: () => Promise<void>)
bench.ts:19
↓ 5 callers
Method
onSizeLessThan
@returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`. If you want to avoid having the queue grow b
source/index.ts:668
↓ 4 callers
Method
#tryToStartAnother
()
source/index.ts:289
↓ 4 callers
Method
sizeBy
Size of the queue, filtered by the given options. For example, this can be used to find the number of items remaining in the queue with a specific p
source/index.ts:794
↓ 3 callers
Method
#cleanupStrictTicks
(now: number)
source/index.ts:137
↓ 3 callers
Method
#clearIntervalTimer
()
source/index.ts:275
↓ 3 callers
Method
#createIntervalTimeout
(delay: number)
source/index.ts:265
↓ 3 callers
Method
#getActiveTicksCount
()
source/index.ts:179
↓ 3 callers
Method
#processQueue
Executes all queued functions until it reaches the limit.
source/index.ts:377
↓ 3 callers
Method
onRateLimitCleared
@returns A promise that settles when the queue is no longer rate-limited.
source/index.ts:718
↓ 2 callers
Method
#clearTimeoutTimer
()
source/index.ts:282
↓ 2 callers
Method
#compact
()
source/priority-queue.ts:119
↓ 2 callers
Method
#initializeIntervalIfNeeded
()
source/index.ts:340
↓ 2 callers
Method
#onInterval
()
source/index.ts:360
↓ 2 callers
Method
#updateRateLimitState
()
source/index.ts:854
↓ 2 callers
Function
monitorState
()
test/advanced.ts:1718
↓ 1 callers
Method
#consumeIntervalSlot
(now: number)
source/index.ts:160
↓ 1 callers
Method
#isIntervalPausedAt
(now: number)
source/index.ts:219
↓ 1 callers
Method
#next
()
source/index.ts:200
↓ 1 callers
Method
#onResumeInterval
()
source/index.ts:211
↓ 1 callers
Method
#rollbackIntervalConsumption
()
source/index.ts:845
↓ 1 callers
Method
#rollbackIntervalSlot
()
source/index.ts:168
↓ 1 callers
Method
#setupRateLimitTracking
()
source/index.ts:813
↓ 1 callers
Function
createTransitions
()
test/rate-limit.ts:233
↓ 1 callers
Function
lowerBound
(array: readonly T[], value: T, comparator: (a: T, b: T) => number)
source/lower-bound.ts:3
↓ 1 callers
Method
run
()
source/index.ts:458
↓ 1 callers
Function
shouldRunBenchmark
(name: string)
bench.ts:16
↓ 1 callers
Function
startPauseCycles
()
test/rate-limit.ts:25
↓ 1 callers
Function
successTask
()
test/strict.ts:700
↓ 1 callers
Function
timeoutTask
()
test/strict.ts:687
Method
#doesConcurrentAllowAnother
()
source/index.ts:196
Method
#doesIntervalAllowAnother
()
source/index.ts:183
Method
cleanupQueueAbortHandler
()
source/index.ts:457
Method
concurrency
()
source/index.ts:382
Method
constructor
(options?: Options<QueueType, EnqueueOptionsType>)
source/index.ts:85
Function
fn
(deferred: Resolvable)
bench.ts:27
Function
fn
()
test/basic.ts:653
Function
fn1
()
test/basic.ts:666
Function
fn2
()
test/basic.ts:670
Function
fn3
()
test/basic.ts:674
Method
handleError
(error: unknown)
source/index.ts:758
Method
isPaused
Whether the queue is currently paused.
source/index.ts:809
Method
isRateLimited
Whether the queue is currently rate-limited due to intervalCap.
source/index.ts:888
Method
isSaturated
Whether the queue is saturated. Returns `true` when: - All concurrency slots are occupied and tasks are waiting, OR - The queue is rate-limited and
source/index.ts:918
Method
listener
()
source/index.ts:769
Function
mapper
([value, ms]: readonly number[])
test/basic.ts:47
Function
noop
()
bench.ts:14
Method
pending
Number of running items (no longer in the queue).
source/index.ts:802
Method
queueAbortHandler
()
source/index.ts:548
Method
removeQueuedTask
()
source/index.ts:535
Method
runningTasks
The tasks currently being executed. Each task includes its `id`, `priority`, `startTime`, `timeout` (if set), and `timeoutRemaining` (milliseconds unt
source/index.ts:954
Method
setPriority
(id: string, priority: number)
source/priority-queue.ts:50
Method
size
Size of the queue, the number of queued items waiting to run.
source/index.ts:785
Method
size
()
source/priority-queue.ts:115