@nerjs/batchloader
Version:
`BatchLoader` is a tool for batching data requests with support for deduplication, caching, and parallel task management. It is designed to enhance flexibility and performance in scenarios requiring asynchronous data processing. This module was inspired b
17 lines (16 loc) • 488 B
TypeScript
import { Key } from '../utils/interfaces';
export type DeduplicatorRunnerCallback<T, R> = (query: T, signal: AbortSignal) => Promise<R> | R;
export interface IDeduplicatorOptions<T> {
/**
* @description Function to extract the key from a query
*/
getKey: (query: T) => Key;
/**
* @description Task execution timeout
*/
timeoutMs: number;
/**
* @description Allows timers to avoid blocking the event loop
*/
unrefTimeouts?: boolean;
}