Skip to content

Commit 530bc4c

Browse files
committed
Use common function for service policy boilerplate
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.
1 parent 7c38c24 commit 530bc4c

File tree

7 files changed

+2968
-0
lines changed

7 files changed

+2968
-0
lines changed

packages/controller-utils/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add `createServicePolicy` function to assist with reducing boilerplate for service classes ([#5053](https://github.com/MetaMask/core/pull/5053))
13+
1014
## [11.4.4]
1115

1216
### Fixed

packages/controller-utils/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@types/bn.js": "^5.1.5",
5656
"bignumber.js": "^9.1.2",
5757
"bn.js": "^5.2.1",
58+
"cockatiel": "^3.1.2",
5859
"eth-ens-namehash": "^2.0.8",
5960
"fast-deep-equal": "^3.1.3"
6061
},
@@ -65,6 +66,7 @@
6566
"deepmerge": "^4.2.2",
6667
"jest": "^27.5.1",
6768
"nock": "^13.3.1",
69+
"sinon": "^9.2.4",
6870
"ts-jest": "^27.1.4",
6971
"typedoc": "^0.24.8",
7072
"typedoc-plugin-missing-exports": "^2.0.0",

0 commit comments

Comments
 (0)