diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-15 16:59:00 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-15 16:59:00 +0100 |
commit | 4966376839365536923cd6cfbb86d15071432e1a (patch) | |
tree | 6658b4a84df5ba6a0189e6d79e37fb0cc7fb597a /src/util | |
parent | f4043a0f8114b1b8612e01a5cdf65b8d6ffc6f00 (diff) | |
download | wallet-core-4966376839365536923cd6cfbb86d15071432e1a.tar.xz |
group refresh sessions into groups for nicer history
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/asyncMemo.ts | 13 |
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 = {}; |