free prepResource in finally
@@ -426,6 +426,7 @@ async function prepareResource(label: string, res: Resource, custom: boolean, re
// .then() that adds to the queue via `runAsyncResourceOp`.
const done: () => void = rpcKeepAlive();
+ try {
// Simply initialize the URN property and get prepared to resolve it later on.
// Note: a resource urn will always get a value, and thus the output property
// for it can always run .apply calls.
@@ -569,9 +570,6 @@ async function prepareResource(label: string, res: Resource, custom: boolean, re
}
}
- // free the RPC queue
- done();
-
return {
resolveURN: resolveURN,
resolveID: resolveID,
@@ -585,6 +583,11 @@ async function prepareResource(label: string, res: Resource, custom: boolean, re
aliases: aliases,
import: importID,
};
+
+ } finally {
+ // free the RPC queue
+ done();
+ }
}
function addAll<T>(to: Set<T>, from: Set<T>) {
