Release 1.3.0
What's Changed
New feature - exponential backoff for retries, using a new HttpAgent option - backoffStrategy
. The agent can accept a BackoffStrategyFactory
, which is a function that returns a BackoffStrategy
. The strategy itself must include a next
method, which yields a number
or null
The default strategy mimics the one used by agent-rs
. It will increase the interval using exponential backoff, and adding in a "jitter", randomizing the result a little to decrease the likelihood of calls firing at the same time as your application scales, which could cause performance issues under certain conditions.
If you prefer a constant backoff, a custom factory would look something like this in TypeScript:
import { HttpAgent, BackoffStrategy } from '@dfinity/agent';
const strat: BackoffStrategy = {
next: () => 1000
}
const agent = new HttpAgent({
backoffStrategy: () => strat
});
- chore: adds required
npm audit
check to PRs by @krpeacock in #880 - feat: retry delay strategy by @krpeacock in #871
- docs: adds instructions on how to run unit and e2e tests to the README by @krpeacock in #881
Full Changelog: v1.2.1...v1.3.0