@crawlee/core
Version:
The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.
26 lines (25 loc) • 1.1 kB
TypeScript
import type { StorageClient } from '@crawlee/types';
import type { LoadSnapshot } from './load_signal';
import { SnapshotStore } from './load_signal';
export interface ClientSnapshot extends LoadSnapshot {
rateLimitErrorCount: number;
}
export interface ClientLoadSignalOptions {
client: StorageClient;
clientSnapshotIntervalSecs?: number;
maxClientErrors?: number;
overloadedRatio?: number;
snapshotHistoryMillis?: number;
}
/**
* Periodically checks the storage client for rate-limit errors (HTTP 429)
* and reports overload when the error delta exceeds a threshold.
*/
// @ts-ignore optional peer dependency or compatibility with es2022
export declare function createClientLoadSignal(options: ClientLoadSignalOptions): Omit<import("./load_signal").LoadSignal, "getSample"> & {
store: SnapshotStore<ClientSnapshot>;
handle: (cb: () => unknown) => void;
getSample(sampleDurationMillis?: number): ClientSnapshot[];
};
/** @internal Return type for backward compat in Snapshotter facade */
export type ClientLoadSignal = ReturnType<typeof createClientLoadSignal>;