@@ -34,15 +34,6 @@ type RetryDelayFunction<TError = unknown> = (
34
34
function defaultRetryDelay ( failureCount : number ) {
35
35
return Math . min ( 1000 * 2 ** failureCount , 30000 )
36
36
}
37
-
38
- interface Cancelable {
39
- cancel ( ) : void
40
- }
41
-
42
- export function isCancelable ( value : any ) : value is Cancelable {
43
- return typeof value ?. cancel === 'function'
44
- }
45
-
46
37
export class CancelledError {
47
38
revert ?: boolean
48
39
silent ?: boolean
@@ -65,7 +56,6 @@ export class Retryer<TData = unknown, TError = unknown> {
65
56
failureCount : number
66
57
isPaused : boolean
67
58
isResolved : boolean
68
- isTransportCancelable : boolean
69
59
promise : Promise < TData >
70
60
71
61
private abort ?: ( ) => void
@@ -86,7 +76,6 @@ export class Retryer<TData = unknown, TError = unknown> {
86
76
this . failureCount = 0
87
77
this . isPaused = false
88
78
this . isResolved = false
89
- this . isTransportCancelable = false
90
79
this . promise = new Promise < TData > ( ( outerResolve , outerReject ) => {
91
80
promiseResolve = outerResolve
92
81
promiseReject = outerReject
@@ -144,18 +133,9 @@ export class Retryer<TData = unknown, TError = unknown> {
144
133
reject ( new CancelledError ( cancelOptions ) )
145
134
146
135
this . abort ?.( )
147
-
148
- // Cancel transport if supported
149
- if ( isCancelable ( promiseOrValue ) ) {
150
- try {
151
- promiseOrValue . cancel ( )
152
- } catch { }
153
- }
154
136
}
155
137
}
156
138
157
- // Check if the transport layer support cancellation
158
- this . isTransportCancelable = isCancelable ( promiseOrValue )
159
139
160
140
Promise . resolve ( promiseOrValue )
161
141
. then ( resolve )
0 commit comments