|
15 | 15 | */ |
16 | 16 |
|
17 | 17 | import { getMetainfo } from '@isomorphic/protocolMetainfo'; |
| 18 | +import { combineSignals } from '@isomorphic/abortSignal'; |
18 | 19 | import { showInternalStackFrames, stringifyStackFrames } from '@utils/stackTrace'; |
19 | 20 | import { isUnderTest } from '@utils/debug'; |
20 | 21 | import { debugLogger } from '@utils/debugLogger'; |
@@ -154,16 +155,18 @@ export abstract class ChannelOwner<T extends channels.Channel = channels.Channel |
154 | 155 | return async (params: any, signal: AbortSignal | undefined) => { |
155 | 156 | return await this._wrapApiCall(async apiZone => { |
156 | 157 | const validatedParams = validator(params, '', this._validatorToWireContext()); |
| 158 | + const def = this._connection._defaultOperationSignal; |
| 159 | + const effectiveSignal = combineSignals(signal, def?.aborted ? undefined : def); |
157 | 160 | if (!apiZone.internal && !apiZone.reported) { |
158 | 161 | // Reporting/tracing/logging this api call for the first time. |
159 | 162 | apiZone.reported = true; |
160 | 163 | this._instrumentation.onApiCallBegin(apiZone, { type: this._type, method: prop, params }); |
161 | 164 | logApiCall(this._logger, `=> ${apiZone.apiName} started`); |
162 | | - return await this._connection.sendMessageToServer(this, prop, validatedParams, { ...apiZone, signal }); |
| 165 | + return await this._connection.sendMessageToServer(this, prop, validatedParams, { ...apiZone, signal: effectiveSignal }); |
163 | 166 | } |
164 | 167 | // Since this api call is either internal, or has already been reported/traced once, |
165 | 168 | // passing as internal. |
166 | | - return await this._connection.sendMessageToServer(this, prop, validatedParams, { internal: true, signal }); |
| 169 | + return await this._connection.sendMessageToServer(this, prop, validatedParams, { internal: true, signal: effectiveSignal }); |
167 | 170 | }, { internal }); |
168 | 171 | }; |
169 | 172 | } |
|
0 commit comments