@@ -98,6 +98,7 @@ type TimeoutInfo = {
98
98
startTime : number ;
99
99
timeout : number ;
100
100
maxTotalTimeout ?: number ;
101
+ resetTimeoutOnProgress : boolean ;
101
102
onTimeout : ( ) => void ;
102
103
} ;
103
104
@@ -179,13 +180,15 @@ export abstract class Protocol<
179
180
messageId : number ,
180
181
timeout : number ,
181
182
maxTotalTimeout : number | undefined ,
182
- onTimeout : ( ) => void
183
+ onTimeout : ( ) => void ,
184
+ resetTimeoutOnProgress : boolean = false
183
185
) {
184
186
this . _timeoutInfo . set ( messageId , {
185
187
timeoutId : setTimeout ( onTimeout , timeout ) ,
186
188
startTime : Date . now ( ) ,
187
189
timeout,
188
190
maxTotalTimeout,
191
+ resetTimeoutOnProgress,
189
192
onTimeout
190
193
} ) ;
191
194
}
@@ -358,7 +361,9 @@ export abstract class Protocol<
358
361
}
359
362
360
363
const responseHandler = this . _responseHandlers . get ( messageId ) ;
361
- if ( this . _timeoutInfo . has ( messageId ) && responseHandler ) {
364
+ const timeoutInfo = this . _timeoutInfo . get ( messageId ) ;
365
+
366
+ if ( timeoutInfo && responseHandler && timeoutInfo . resetTimeoutOnProgress ) {
362
367
try {
363
368
this . _resetTimeout ( messageId ) ;
364
369
} catch ( error ) {
@@ -520,7 +525,7 @@ export abstract class Protocol<
520
525
{ timeout }
521
526
) ) ;
522
527
523
- this . _setupTimeout ( messageId , timeout , options ?. maxTotalTimeout , timeoutHandler ) ;
528
+ this . _setupTimeout ( messageId , timeout , options ?. maxTotalTimeout , timeoutHandler , options ?. resetTimeoutOnProgress ?? false ) ;
524
529
525
530
this . _transport . send ( jsonrpcRequest ) . catch ( ( error ) => {
526
531
this . _cleanupTimeout ( messageId ) ;
0 commit comments