10 lines
353 B
TypeScript
10 lines
353 B
TypeScript
import { setImmediate } from 'node:timers/promises';
|
|
|
|
export const PREPARATION_BATCH_SIZE = 2048;
|
|
|
|
/** Yield to cancellation, timeouts and lease heartbeats between bounded CPU batches. */
|
|
export async function preparationCheckpoint(signal?: AbortSignal): Promise<void> {
|
|
signal?.throwIfAborted();
|
|
await setImmediate();
|
|
signal?.throwIfAborted();
|
|
}
|