You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/content/docs/adapters/websocket.mdx
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -287,22 +287,23 @@ const link = new RPCLink({
287
287
288
288
/**
289
289
* Maximum number of consecutive failed attempts before giving up.
290
+
* It counts every attempt of a (re)connect cycle, the first one included (see `attempt`),
291
+
* so it should be at least 1.
290
292
* When reached, calls waiting for the connection fail, and the next
291
293
* call starts a new reconnect cycle.
292
-
* Should greater than 1
293
294
*
294
295
* @defaultInfinity
295
296
*/
296
-
maxAttempt: Infinity,
297
+
maxAttempts: Infinity,
297
298
298
299
/**
299
300
* Maximum number of connection attempts over the transport's lifetime,
300
-
* successful ones included (see `totalAttempt`).
301
+
* successful ones included (see `totalAttempts`).
301
302
* When reached, calls that need a new connection fail instead of connecting.
302
303
*
303
304
* @defaultInfinity
304
305
*/
305
-
maxTotalAttempt: Infinity,
306
+
maxTotalAttempts: Infinity,
306
307
307
308
/**
308
309
* Whether to proactively reconnect right after the socket closes,
@@ -325,5 +326,5 @@ const link = new RPCLink({
325
326
```
326
327
327
328
:::info
328
-
A connection proves healthy once it receives a message from the server or stays open for 5 seconds. Only then does `attempt` reset to 1. A server that closes connections right after the handshake, for example to reject authentication, gets the `delay` backoff and the `maxAttempt` limit instead of an immediate reconnect loop.
329
+
A connection proves healthy once it receives a message from the server or stays open for 5 seconds. Only then does `attempt` reset to 1. A server that closes connections right after the handshake, for example to reject authentication, gets the `delay` backoff and the `maxAttempts` limit instead of an immediate reconnect loop.
Copy file name to clipboardExpand all lines: apps/content/docs/migrations/from-v1.mdx
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -979,6 +979,26 @@ const retryPlugin = new RetryLinkPlugin({
979
979
})
980
980
```
981
981
982
+
### Retry After Plugin
983
+
984
+
The `condition` option of [`RetryAfterLinkPlugin`](/docs/plugins/retry-after) was renamed to `shouldRetry`, matching the Retry Plugin:
985
+
986
+
<CodeGroup>
987
+
988
+
```ts v2
989
+
const retryAfterPlugin =newRetryAfterLinkPlugin({
990
+
shouldRetry: (response) =>response.status===429,
991
+
})
992
+
```
993
+
994
+
```ts v1
995
+
const retryAfterPlugin =newRetryAfterPlugin({
996
+
condition: (response) =>response.status===429,
997
+
})
998
+
```
999
+
1000
+
</CodeGroup>
1001
+
982
1002
## Contract-First
983
1003
984
1004
Contract types and utilities changed word order from `ContractRouter*` to `RouterContract*`. Deprecated aliases exist for all of them. See [Procedure Contract](/docs/contract/procedure) and [Router Contract](/docs/contract/router).
Copy file name to clipboardExpand all lines: apps/content/docs/plugins/retry-after.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,15 +25,15 @@ Requests whose body is a [`ReadableStream`](/docs/binary-data#readablestreamuint
25
25
26
26
## Options
27
27
28
-
By default, the plugin retries only requests that receive a `429` (Too Many Requests) or `503` (Service Unavailable) status code. It times out after 5 minutes and allows up to 3 retry attempts. You can customize this behavior with the following options:
28
+
By default, the plugin retries only requests that receive a `429` (Too Many Requests) or `503` (Service Unavailable) status code. It allows up to 3 attempts in total, the first request included, and stops retrying once the total wait would exceed 5 minutes. You can customize this behavior with the following options:
The following context options control retry behavior:
60
60
61
-
-**retry:** Maximum number of retry attempts before throwing an error _(default: `0`)_.
62
-
-**retryDelay:** Delay between retry attempts_(default: `(o) => o.lastEventRetry ?? 2000`)_.
61
+
-**retry:** Maximum number of retries after the first call before throwing an error. The first call is not counted, so `3` allows up to 4 attempts in total_(default: `0`)_.
62
+
-**retryDelay:** Delay before each retry, in milliseconds_(default: `(o) => o.lastEventRetry ?? 2000`)_.
63
63
-**shouldRetry:** Function that determines whether a retry should be attempted _(default: `(o) => isRetryableError(o.error)`, see [Client Error Responses](#client-error-responses))_.
64
64
65
65
You can override the default retry behavior globally by passing `default` options when initializing the plugin:
0 commit comments