Skip to content

Commit 6a8cd37

Browse files
chore(release): 🎉 3.0.0 [skip ci]
# [3.0.0](v2.0.1...v3.0.0) (2020-12-09) ### Features * **client:** Retry with randomised exponential backoff or provide your own strategy ([#84](#84)) ([d3e7a17](d3e7a17)) ### BREAKING CHANGES * **client:** Client `retryTimeout` option has been replaced with the new `retryWait`. `retryWait` allows you to control the retry timeout strategy by resolving the returned promise when ready. The default implements the randomised exponential backoff like so: ```ts // this is the default const retryWait = async function randomisedExponentialBackoff(retries: number) { let retryDelay = 1000; // start with 1s delay for (let i = 0; i < retries; i++) { retryDelay *= 2; // square `retries` times } await new Promise((resolve) => setTimeout( // resolve pending promise with added random timeout from 300ms to 3s resolve, retryDelay + Math.floor(Math.random() * (3000 - 300) + 300), ), ); }; ```
1 parent d3e7a17 commit 6a8cd37

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

CHANGELOG.md

+30
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
# [3.0.0](https://github.com/enisdenjo/graphql-ws/compare/v2.0.1...v3.0.0) (2020-12-09)
2+
3+
4+
### Features
5+
6+
* **client:** Retry with randomised exponential backoff or provide your own strategy ([#84](https://github.com/enisdenjo/graphql-ws/issues/84)) ([d3e7a17](https://github.com/enisdenjo/graphql-ws/commit/d3e7a171603a3ef181c5af533768dcda416a1731))
7+
8+
9+
### BREAKING CHANGES
10+
11+
* **client:** Client `retryTimeout` option has been replaced with the new `retryWait`.
12+
13+
`retryWait` allows you to control the retry timeout strategy by resolving the returned promise when ready. The default implements the randomised exponential backoff like so:
14+
```ts
15+
// this is the default
16+
const retryWait = async function randomisedExponentialBackoff(retries: number) {
17+
let retryDelay = 1000; // start with 1s delay
18+
for (let i = 0; i < retries; i++) {
19+
retryDelay *= 2; // square `retries` times
20+
}
21+
await new Promise((resolve) =>
22+
setTimeout(
23+
// resolve pending promise with added random timeout from 300ms to 3s
24+
resolve,
25+
retryDelay + Math.floor(Math.random() * (3000 - 300) + 300),
26+
),
27+
);
28+
};
29+
```
30+
131
## [2.0.1](https://github.com/enisdenjo/graphql-ws/compare/v2.0.0...v2.0.1) (2020-12-03)
232

333

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-ws",
3-
"version": "2.0.1",
3+
"version": "3.0.0",
44
"description": "Coherent, zero-dependency, lazy, simple, GraphQL over WebSocket Protocol compliant server and client",
55
"keywords": [
66
"protocol",

0 commit comments

Comments
 (0)