Module utils/load-balance
Functions
Const loadBalance
- loadBalance<F, First>(fn: F, values: First[], retries?: number): (...args: Parameters<OmitFirstArg<F>>) => Promise<Await<ReturnType<F>>>
-
Type parameters
-
F: (first: First, ...args: any[]) => Promise<any>
-
First
Parameters
-
fn: F
-
values: First[]
-
retries: number = 3
Returns (...args: Parameters<OmitFirstArg<F>>) => Promise<Await<ReturnType<F>>>
-
- (...args: Parameters<OmitFirstArg<F>>): Promise<Await<ReturnType<F>>>
-
Parameters
-
Rest ...args: Parameters<OmitFirstArg<F>>
Returns Promise<Await<ReturnType<F>>>
roundRobin
- roundRobin<T>(array: T[]): Generator<T, T>
-
Type parameters
Parameters
Returns Generator<T, T>
Perform a function call with sequenced first argument, useful for load balancing node calls. This will retry up to
retries
times if an error occurs.