@matrixai/rpc
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -241,9 +241,20 @@ "use strict"; | ||
let rpcStream; | ||
const streamFactoryProm = this.streamFactory({ signal, timer }); | ||
const streamFactoryProm = this.streamFactory({ signal, timer }).then((e) => ({ status: 'fulfilled', value: e }), (e) => ({ status: 'rejected', reason: e })); | ||
try { | ||
rpcStream = await Promise.race([streamFactoryProm, abortRaceProm.p]); | ||
const rpcStreamResult = await Promise.race([ | ||
streamFactoryProm, | ||
abortRaceProm.p, | ||
]); | ||
if (rpcStreamResult.status === 'rejected') { | ||
throw rpcStreamResult.reason; | ||
} | ||
rpcStream = rpcStreamResult.value; | ||
} | ||
catch (e) { | ||
cleanUp(); | ||
void streamFactoryProm.then((stream) => stream.cancel(errors.ErrorRPCStreamEnded)); | ||
void streamFactoryProm.then((streamResult) => { | ||
if (streamResult.status === 'fulfilled') { | ||
streamResult.value.cancel(errors.ErrorRPCStreamEnded); | ||
} | ||
}); | ||
throw e; | ||
@@ -250,0 +261,0 @@ } |
{ | ||
"name": "@matrixai/rpc", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"author": "Matrix AI", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
261866
3062