Skip to content

Release 1.3.0

Compare
Choose a tag to compare
@github-actions github-actions released this 01 May 22:44
· 60 commits to main since this release
21e8d2b

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
});

Full Changelog: v1.2.1...v1.3.0