diff --git a/src/misc/sequentialize.ts b/src/misc/sequentialize.ts index 221b9da23b..ab64074472 100644 --- a/src/misc/sequentialize.ts +++ b/src/misc/sequentialize.ts @@ -32,13 +32,12 @@ export function sequentialize(cacheKey: (args: any[]) => string) { return response; } - response = originalMethod.apply(this, args) - .finally(() => { - cache.delete(argsCacheKey); - if (cache.size === 0) { - caches.delete(this); - } - }); + response = originalMethod.apply(this, args).finally(() => { + cache.delete(argsCacheKey); + if (cache.size === 0) { + caches.delete(this); + } + }); cache.set(argsCacheKey, response); return response;