From 4966376839365536923cd6cfbb86d15071432e1a Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 15 Dec 2019 16:59:00 +0100 Subject: group refresh sessions into groups for nicer history --- src/util/asyncMemo.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/util') 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 { 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 = {}; -- cgit v1.2.3