json-rpc-middleware-stream
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -9,2 +9,6 @@ # Changelog | ||
## [4.1.0] | ||
### Changed | ||
- Added retry limit of 3 to requests ([#30](https://github.com/MetaMask/json-rpc-middleware-stream/pull/30)) | ||
## [4.0.0] - 2022-10-03 | ||
@@ -22,4 +26,5 @@ ### Changed | ||
[Unreleased]: https://github.com/MetaMask/json-rpc-middleware-stream/compare/v4.0.0...HEAD | ||
[Unreleased]: https://github.com/MetaMask/json-rpc-middleware-stream/compare/v4.1.0...HEAD | ||
[4.1.0]: https://github.com/MetaMask/json-rpc-middleware-stream/compare/v4.0.0...v4.1.0 | ||
[4.0.0]: https://github.com/MetaMask/json-rpc-middleware-stream/compare/v3.0.0...v4.0.0 | ||
[3.0.0]: https://github.com/MetaMask/json-rpc-middleware-stream/releases/tag/v3.0.0 |
@@ -97,4 +97,12 @@ "use strict"; | ||
function retryStuckRequests() { | ||
Object.values(idMap).forEach(({ req }) => { | ||
// TODO: limiting retries could be implemented here | ||
Object.values(idMap).forEach(({ req, retryCount = 0 }) => { | ||
// Avoid retrying requests without an id - they cannot have matching responses so retry logic doesn't apply | ||
// Check for retry count below ensure that a request is not retried more than 3 times | ||
if (!req.id) { | ||
return; | ||
} | ||
if (retryCount >= 3) { | ||
throw new Error(`StreamMiddleware - Retry limit exceeded for request id "${req.id}"`); | ||
} | ||
idMap[req.id].retryCount = retryCount + 1; | ||
sendToStream(req); | ||
@@ -101,0 +109,0 @@ }); |
{ | ||
"name": "json-rpc-middleware-stream", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "A small toolset for streaming JSON-RPC data and matching requests and responses.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20821
197
0