Skip to content

Commit 1323b2e

Browse files
committed
Improve docs
1 parent 6d6700f commit 1323b2e

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,18 +383,18 @@ const json = await ky('https://example.com', {
383383
Type: `number | false`\
384384
Default: `10000`
385385

386-
Timeout in milliseconds for getting a response. Each retry attempt gets the full timeout. Cannot be greater than 2147483647.
386+
Per-attempt timeout in milliseconds for getting a response, applied independently to each retry. Cannot be greater than 2147483647. See also [`totalTimeout`](#totaltimeout).
387387

388-
If set to `false`, there will be no timeout.
388+
If set to `false`, there will be no per-attempt timeout.
389389

390390
##### totalTimeout
391391

392392
Type: `number | false`\
393393
Default: `false`
394394

395-
Total timeout in milliseconds for the entire operation, including all retries and delays. Cannot be greater than 2147483647. Throws a `TimeoutError` if exceeded.
395+
Overall timeout in milliseconds for the entire operation, including retries and delays. Throws a `TimeoutError` if exceeded. Cannot be greater than 2147483647.
396396

397-
This is useful when you want to cap the total time spent on an operation, while still allowing each individual retry to use the full per-attempt `timeout`.
397+
If set to `false` or not specified, there is no overall timeout.
398398

399399
```js
400400
import ky from 'ky';

source/types/options.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,18 @@ export type KyOptions = {
171171
retry?: RetryOptions | number;
172172

173173
/**
174-
Timeout in milliseconds for getting a response. Each retry attempt gets the full timeout. Cannot be greater than 2147483647.
174+
Per-attempt timeout in milliseconds for getting a response, applied independently to each retry. Cannot be greater than 2147483647. See also `totalTimeout`.
175175
176-
If set to `false`, there will be no timeout.
176+
If set to `false`, there will be no per-attempt timeout.
177177
178178
@default 10000
179179
*/
180180
timeout?: number | false;
181181

182182
/**
183-
Total timeout in milliseconds for the entire operation, including all retries and delays. Cannot be greater than 2147483647. Throws a `TimeoutError` if exceeded.
183+
Overall timeout in milliseconds for the entire operation, including retries and delays. Throws a `TimeoutError` if exceeded. Cannot be greater than 2147483647.
184184
185-
This is useful when you want to cap the total time spent on an operation, while still allowing each individual retry to use the full per-attempt `timeout`.
186-
187-
If set to `false` or not specified, there is no total timeout.
185+
If set to `false` or not specified, there is no overall timeout.
188186
189187
@default false
190188

0 commit comments

Comments
 (0)