nice-grpc-client-middleware-retry
Advanced tools
Comparing version 1.1.2 to 2.0.0
@@ -31,3 +31,3 @@ import { ClientError, ClientMiddleware, Status } from 'nice-grpc-common'; | ||
* | ||
* Defaults to 15 seconds. | ||
* Defaults to 30 seconds. | ||
* | ||
@@ -34,0 +34,0 @@ * Example: if `retryBaseDelayMs` is 1000 and `retryMaxDelayMs` is 3000, then |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,3 +6,2 @@ exports.retryMiddleware = void 0; | ||
const nice_grpc_common_1 = require("nice-grpc-common"); | ||
const node_abort_controller_1 = __importDefault(require("node-abort-controller")); | ||
const defaultRetryableStatuses = [ | ||
@@ -25,7 +21,7 @@ nice_grpc_common_1.Status.UNKNOWN, | ||
idempotencyLevel === 'NO_SIDE_EFFECTS'; | ||
const { retry = isIdempotent, retryBaseDelayMs = 1000, retryMaxDelayMs = 15000, retryMaxAttempts = 1, onRetryableError, retryableStatuses = defaultRetryableStatuses, ...restOptions } = options; | ||
const { retry = isIdempotent, retryBaseDelayMs = 1000, retryMaxDelayMs = 30000, retryMaxAttempts = 1, onRetryableError, retryableStatuses = defaultRetryableStatuses, ...restOptions } = options; | ||
if (call.requestStream || call.responseStream || !retry) { | ||
return yield* call.next(call.request, restOptions); | ||
} | ||
const signal = (_a = options.signal) !== null && _a !== void 0 ? _a : new node_abort_controller_1.default().signal; | ||
const signal = (_a = options.signal) !== null && _a !== void 0 ? _a : new AbortController().signal; | ||
for (let attempt = 0;; attempt++) { | ||
@@ -32,0 +28,0 @@ try { |
@@ -5,8 +5,8 @@ The MIT License (MIT) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
@@ -17,7 +17,6 @@ The above copyright notice and this permission notice shall be included in all | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "nice-grpc-client-middleware-retry", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"description": "Retry client middleware for nice-grpc", | ||
@@ -28,11 +28,10 @@ "repository": "deeplay-io/nice-grpc", | ||
"jest-mock-random": "^1.1.1", | ||
"nice-grpc": "^1.2.2", | ||
"nice-grpc": "^2.0.0", | ||
"ts-proto": "^1.112.0" | ||
}, | ||
"dependencies": { | ||
"abort-controller-x": "^0.2.6", | ||
"nice-grpc-common": "^1.1.0", | ||
"node-abort-controller": "^2.0.0" | ||
"abort-controller-x": "^0.4.0", | ||
"nice-grpc-common": "^2.0.0" | ||
}, | ||
"gitHead": "1eae2167ee0eeb1e7ab0f56278716b59269ffe46" | ||
"gitHead": "0174f605350065a6d9f89df38c6694ba75b891ac" | ||
} |
@@ -75,3 +75,4 @@ # nice-grpc-client-middleware-retry [![npm version][npm-image]][npm-url] <!-- omit in toc --> | ||
You can also set `retryMaxAttempts` to `Infinity` and use `AbortSignal` to | ||
You can also set `retryMaxAttempts` to `Infinity` and use | ||
[`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to | ||
[cancel](https://github.com/deeplay-io/nice-grpc/tree/master/packages/nice-grpc#cancelling-calls) | ||
@@ -81,4 +82,2 @@ the retried call: | ||
```ts | ||
import AbortController from 'node-abort-controller'; | ||
const abortController = new AbortController(); | ||
@@ -85,0 +84,0 @@ |
import {delay, rethrowAbortError} from 'abort-controller-x'; | ||
import {ClientError, ClientMiddleware, Status} from 'nice-grpc-common'; | ||
import AbortController from 'node-abort-controller'; | ||
@@ -34,3 +33,3 @@ /** | ||
* | ||
* Defaults to 15 seconds. | ||
* Defaults to 30 seconds. | ||
* | ||
@@ -85,3 +84,3 @@ * Example: if `retryBaseDelayMs` is 1000 and `retryMaxDelayMs` is 3000, then | ||
retryBaseDelayMs = 1000, | ||
retryMaxDelayMs = 15000, | ||
retryMaxDelayMs = 30000, | ||
retryMaxAttempts = 1, | ||
@@ -88,0 +87,0 @@ onRetryableError, |
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
2
15589
218
130
+ Addedabort-controller-x@0.4.3(transitive)
+ Addednice-grpc-common@2.0.2(transitive)
- Removednode-abort-controller@^2.0.0
- Removedabort-controller-x@0.2.7(transitive)
- Removednice-grpc-common@1.1.0(transitive)
- Removednode-abort-controller@2.0.0(transitive)
Updatedabort-controller-x@^0.4.0
Updatednice-grpc-common@^2.0.0