summaryrefslogtreecommitdiff
path: root/src/util/asyncMemo.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/asyncMemo.ts')
-rw-r--r--src/util/asyncMemo.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/util/asyncMemo.ts b/src/util/asyncMemo.ts
index 193ce6df6..17204a88e 100644
--- a/src/util/asyncMemo.ts
+++ b/src/util/asyncMemo.ts
@@ -39,15 +39,14 @@ export class AsyncOpMemoMap<T> {
const n = this.n++;
// Wrap the operation in case it immediately throws
const p = Promise.resolve().then(() => pg());
- p.finally(() => {
- this.cleanUp(key, n);
- });
this.memoMap[key] = {
- p,
- n,
- t: new Date().getTime(),
+ p,
+ n,
+ t: new Date().getTime(),
};
- return p;
+ return p.finally(() => {
+ this.cleanUp(key, n);
+ });
}
clear() {
this.memoMap = {};