From 91100f94b5644471fb074870c2166c4deae633d0 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sat, 14 May 2022 06:28:27 +0200 Subject: [PATCH] perf: fix caching (#8660) The cache implementation did previously not store the results of the computation and was thus not a cache at all. This can cause a significant number of database queries each time someone with a large number of followers does something that causes an activity to be federated. --- packages/backend/src/misc/cache.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/backend/src/misc/cache.ts b/packages/backend/src/misc/cache.ts index 01bbe98a8..e5b911ed3 100644 --- a/packages/backend/src/misc/cache.ts +++ b/packages/backend/src/misc/cache.ts @@ -48,6 +48,7 @@ export class Cache { // Cache MISS const value = await fetcher(); + this.set(key, value); return value; }