Skip to main content

Class: ReliableFetch

Constructors​

constructor​

• new ReliableFetch(input, init?)

Parameters​

NameType
inputReliableRequestInfo
initReliableRequestInit

Defined in​

index.ts:14

Properties​

init​

• Private init: ReliableRequestInit = {}

Defined in​

index.ts:16


input​

• Private input: ReliableRequestInfo

Defined in​

index.ts:15

Methods​

chaos​

▸ chaos(config?): Promise<Response>

The request will behave chaotically (e.g. down, slow) at the configured rate (e.g. set config.rate to 0.1 to impact ~10% of requests).

Parameters​

NameTypeDescription
config?Partial<ChaosConfig>chaos config

Returns​

Promise<Response>

Defined in​

index.ts:73


hedge​

▸ hedge(config?): Promise<Response>

The initial request will be aborted if it does not settle within the configured timeout and hedged with another request (e.g. set config.timeout to the 95th percentile response time to hedge 5% of requests).

See

https://courses.cs.duke.edu//cps296.4/fall13/838-CloudPapers/dean_longtail.pdf

Parameters​

NameTypeDescription
config?Partial<HedgeConfig>hedge config

Returns​

Promise<Response>

Defined in​

index.ts:57


on​

▸ on(eventName, listener): ReliableFetch

Listen for a specific lifecycle event by event name.

Parameters​

NameTypeDescription
eventNameEventNameunique identifier for a lifecycle event
listenerEventListenerFunctioncallback function for when the lifecycle event is emitted

Returns​

ReliableFetch

Defined in​

index.ts:27


retry​

▸ retry(config?): Promise<Response>

The request will be retried based on the config.

See

https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

Parameters​

NameTypeDescription
config?Partial<RetryConfig>retry config

Returns​

Promise<Response>

Defined in​

index.ts:90


timeout​

▸ timeout(config?): Promise<Response>

The request will be aborted with an AbortError if it does not settle within the configured timeout.

Parameters​

NameTypeDescription
config?Partial<TimeoutConfig>timeout config

Returns​

Promise<Response>

Defined in​

index.ts:42