Class: ReliableFetch
Constructors
constructor
• new ReliableFetch(input
, init?
)
Parameters
Name | Type |
---|---|
input | ReliableRequestInfo |
init | ReliableRequestInit |
Defined in
Properties
init
• Private
init: ReliableRequestInit
= {}
Defined in
input
• Private
input: ReliableRequestInfo
Defined in
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
Name | Type | Description |
---|---|---|
config? | Partial <ChaosConfig > | chaos config |
Returns
Promise
<Response
>
Defined in
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
Name | Type | Description |
---|---|---|
config? | Partial <HedgeConfig > | hedge config |
Returns
Promise
<Response
>
Defined in
on
▸ on(eventName
, listener
): ReliableFetch
Listen for a specific lifecycle event by event name.
Parameters
Name | Type | Description |
---|---|---|
eventName | EventName | unique identifier for a lifecycle event |
listener | EventListenerFunction | callback function for when the lifecycle event is emitted |
Returns
Defined in
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
Name | Type | Description |
---|---|---|
config? | Partial <RetryConfig > | retry config |
Returns
Promise
<Response
>
Defined in
timeout
▸ timeout(config?
): Promise
<Response
>
The request will be aborted with an AbortError
if it does not settle
within the configured timeout.
Parameters
Name | Type | Description |
---|---|---|
config? | Partial <TimeoutConfig > | timeout config |
Returns
Promise
<Response
>