Skip to content

Commit

Permalink
Use common function for service policy boilerplate
Browse files Browse the repository at this point in the history
We would like to use the Cockatiel library in our service classes to
ensure that requests are retried using the circuit breaker pattern. Some
of our service classes do this already, but we are copying and pasting
the code around. This commit extracts the boilerplate code to a new
function in the `@metamask/controller-utils` package,
`createServicePolicy`, so that we no longer have to do this.
  • Loading branch information
mcmire committed Jan 8, 2025
1 parent 7c38c24 commit 530bc4c
Show file tree
Hide file tree
Showing 7 changed files with 2,968 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/controller-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `createServicePolicy` function to assist with reducing boilerplate for service classes ([#5053](https://github.com/MetaMask/core/pull/5053))

## [11.4.4]

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions packages/controller-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@types/bn.js": "^5.1.5",
"bignumber.js": "^9.1.2",
"bn.js": "^5.2.1",
"cockatiel": "^3.1.2",
"eth-ens-namehash": "^2.0.8",
"fast-deep-equal": "^3.1.3"
},
Expand All @@ -65,6 +66,7 @@
"deepmerge": "^4.2.2",
"jest": "^27.5.1",
"nock": "^13.3.1",
"sinon": "^9.2.4",
"ts-jest": "^27.1.4",
"typedoc": "^0.24.8",
"typedoc-plugin-missing-exports": "^2.0.0",
Expand Down
Loading

0 comments on commit 530bc4c

Please sign in to comment.