Registry / devops / typescript-blocking-queue

typescript-blocking-queue

JSON →
library1.2.3jsnpmunverified

A TypeScript library providing prioritized blocking queues with whenReady support, designed to handle bottlenecks like authentication refresh. Version 1.2.3 is the current stable release; the library is actively maintained on GitHub. It offers multiple priority levels, deadlock warnings, and full TypeScript support. Unlike many queue libraries, it includes a whenReady queue that executes only after prioritized jobs finish, making it ideal for token refresh patterns.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM only; named export. The package is TypeScript-native.

import { newPrioritizedBlockingQueue } from 'typescript-blocking-queue'

PriorityQueue is a type, not a runtime export. Use with import type for TypeScript.

import type { PriorityQueue } from 'typescript-blocking-queue'

WhenReadyQueue is also a type only. The correct runtime usage is via the returned object from newPrioritizedBlockingQueue.

import type { WhenReadyQueue } from 'typescript-blocking-queue'

Creates a blocking queue with 2 priority levels, enqueues a prioritized job, and demonstrates whenReady execution.

import { newPrioritizedBlockingQueue } from 'typescript-blocking-queue'; async function example() { const queue = newPrioritizedBlockingQueue(2); const result = await queue.prioritized(0).enqueue(async () => { // Simulate auth refresh return 'authenticated'; }); // When prioritized queues are empty, whenReady jobs run queue.whenReady().enqueue(async () => { console.log('When ready: all prioritized jobs done'); }); console.log(result); // 'authenticated' } example().catch(console.error);
Debug
Known footguns
gotchaDo not await enqueue inside a queue's execution callback – it will cause a deadlock.
gotchaWhen queue.prioritized() index is omitted, it defaults to 0; ensure you specify the index if multiple priority levels exist.
gotchawhenReady() jobs may run concurrently if the queue is empty; they are not serialized.
deprecatedNo deprecated features reported; library is stable.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
3
bingbot
1
Resources