Skip to content

Commit f499740

Browse files
committed
Improve docs
1 parent 1380648 commit f499740

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
@@ -187,20 +187,18 @@ export type KyOptions = {
187187
retry?: RetryOptions | number;
188188

189189
/**
190-
Timeout in milliseconds for getting a response. Each retry attempt gets the full timeout. Cannot be greater than 2147483647.
190+
Per-attempt timeout in milliseconds for getting a response, applied independently to each retry. Cannot be greater than 2147483647. See also `totalTimeout`.
191191
192-
If set to `false`, there will be no timeout.
192+
If set to `false`, there will be no per-attempt timeout.
193193
194194
@default 10000
195195
*/
196196
timeout?: number | false;
197197

198198
/**
199-
Total timeout in milliseconds for the entire operation, including all retries and delays. Cannot be greater than 2147483647. Throws a `TimeoutError` if exceeded.
199+
Overall timeout in milliseconds for the entire operation, including retries and delays. Throws a `TimeoutError` if exceeded. Cannot be greater than 2147483647.
200200
201-
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`.
202-
203-
If set to `false` or not specified, there is no total timeout.
201+
If set to `false` or not specified, there is no overall timeout.
204202
205203
@default false
206204

0 commit comments

Comments
 (0)