File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 11import { log } from './logger.js'
22import type { StallDetectionOptions } from './options.js'
3- import type { HttpStack } from './options.js'
43
54export class StallDetector {
65 private options : StallDetectionOptions
7- private httpStack : HttpStack
86 private onStallDetected : ( reason : string ) => void
97
108 private intervalId : ReturnType < typeof setInterval > | null = null
119 private lastProgressTime = 0
1210 private lastProgressValue = 0
1311 private isActive = false
1412
15- constructor (
16- options : StallDetectionOptions ,
17- httpStack : HttpStack ,
18- onStallDetected : ( reason : string ) => void ,
19- ) {
13+ constructor ( options : StallDetectionOptions , onStallDetected : ( reason : string ) => void ) {
2014 this . options = options
21- this . httpStack = httpStack
2215 this . onStallDetected = onStallDetected
2316 }
2417
Original file line number Diff line number Diff line change @@ -850,17 +850,13 @@ export class BaseUpload {
850850 if ( this . options . stallDetection ?. enabled ) {
851851 // Only enable stall detection if the HTTP stack supports progress events
852852 if ( this . options . httpStack . supportsProgressEvents ( ) ) {
853- stallDetector = new StallDetector (
854- this . options . stallDetection ,
855- this . options . httpStack ,
856- ( reason : string ) => {
857- // Handle stall by aborting the current request and triggering retry
858- if ( this . _req ) {
859- this . _req . abort ( )
860- }
861- this . _retryOrEmitError ( new Error ( `Upload stalled: ${ reason } ` ) )
862- } ,
863- )
853+ stallDetector = new StallDetector ( this . options . stallDetection , ( reason : string ) => {
854+ // Handle stall by aborting the current request and triggering retry
855+ if ( this . _req ) {
856+ this . _req . abort ( )
857+ }
858+ this . _retryOrEmitError ( new Error ( `Upload stalled: ${ reason } ` ) )
859+ } )
864860 // Don't start yet - will be started after onBeforeRequest
865861 } else {
866862 log (
You can’t perform that action at this time.
0 commit comments