Skip to content

Commit ead2cf0

Browse files
committed
fixup! Add stall detection to recover from frozen uploads
1 parent 772bcee commit ead2cf0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/api.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,34 @@ Following example will trigger up to three retries, each after 1s, 3s and 5s res
208208
retryDelays: [1000, 3000, 5000]
209209
```
210210

211+
#### stallDetection
212+
213+
_Default value:_ `{ enabled: false, stallTimeout: 30000, checkInterval: 5000 }`
214+
215+
An object controlling the stall detection feature, which can automatically detect when an upload has stopped making progress and trigger a retry. This is useful for recovering from frozen uploads caused by network issues that don't trigger explicit errors.
216+
217+
The stall detection options are:
218+
- `enabled`: Boolean indicating whether stall detection is active (default: `false`)
219+
- `stallTimeout`: Time in milliseconds without progress before considering the upload stalled (default: `30000`)
220+
- `checkInterval`: How often in milliseconds to check for stalls (default: `5000`)
221+
222+
**Note:** Stall detection only works with HTTP stacks that support progress events. Currently, this includes:
223+
- `XHRHttpStack` (browser default) - Supported
224+
- `NodeHttpStack` (Node.js default) - Supported
225+
- `FetchHttpStack` - Not supported
226+
227+
When a stall is detected, the upload will be automatically retried according to your `retryDelays` configuration. If `retryDelays` is `null`, the stall will trigger an error instead.
228+
229+
Example configuration:
230+
231+
```js
232+
stallDetection: {
233+
enabled: true,
234+
stallTimeout: 15000, // 15 seconds without progress
235+
checkInterval: 2000 // Check every 2 seconds
236+
}
237+
```
238+
211239
#### storeFingerprintForResuming
212240

213241
_Default value:_ `true`

0 commit comments

Comments
 (0)