@hotmeshio/hotmesh
Version:
Permanent-Memory Workflows & AI Agents
24 lines (23 loc) • 821 B
TypeScript
export declare class ThrottleManager {
private throttle;
private isSleeping;
private sleepPromiseResolve;
private innerPromiseResolve;
private sleepTimeout;
constructor(initialThrottle?: number);
getThrottle(): number;
setThrottle(delayInMillis: number): void;
isPaused(): boolean;
/**
* An adjustable throttle that will interrupt a sleeping
* router if the throttle is reduced and the sleep time
* has elapsed. If the throttle is increased, or if
* the sleep time has not elapsed, the router will continue
* to sleep until the new termination point. This
* allows for dynamic, elastic throttling with smooth
* acceleration and deceleration.
*/
customSleep(): Promise<void>;
cancelThrottle(): void;
private resetThrottleState;
}