summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/RoleService.ts
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2024-08-06 16:51:18 +0000
committerdakkar <dakkar@thenautilus.net>2024-08-06 16:51:18 +0000
commit4e7df7a5f21f91d49318840600fe329cae05c919 (patch)
tree701cdaa4a1ae06412d86fc98529aa45ae26ae190 /packages/backend/src/core/RoleService.ts
parentmerge: Add icon for moving files/folders - for !583 (!586) (diff)
parentFix timeout comments (diff)
downloadsharkey-4e7df7a5f21f91d49318840600fe329cae05c919.tar.gz
sharkey-4e7df7a5f21f91d49318840600fe329cae05c919.tar.bz2
sharkey-4e7df7a5f21f91d49318840600fe329cae05c919.zip
merge: Remove infinite caches to prevent memory leak (!587)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/587 Closes #600 and #601 Approved-by: Amelia Yukii <amelia.yukii@shourai.de> Approved-by: Marie <marie@kaifa.ch>
Diffstat (limited to 'packages/backend/src/core/RoleService.ts')
-rw-r--r--packages/backend/src/core/RoleService.ts6
1 files changed, 2 insertions, 4 deletions
diff --git a/packages/backend/src/core/RoleService.ts b/packages/backend/src/core/RoleService.ts
index f5a753afc7..2b6089fd3a 100644
--- a/packages/backend/src/core/RoleService.ts
+++ b/packages/backend/src/core/RoleService.ts
@@ -129,10 +129,8 @@ export class RoleService implements OnApplicationShutdown, OnModuleInit {
private moderationLogService: ModerationLogService,
private fanoutTimelineService: FanoutTimelineService,
) {
- //this.onMessage = this.onMessage.bind(this);
-
- this.rolesCache = new MemorySingleCache<MiRole[]>(1000 * 60 * 60 * 1);
- this.roleAssignmentByUserIdCache = new MemoryKVCache<MiRoleAssignment[]>(1000 * 60 * 60 * 1);
+ this.rolesCache = new MemorySingleCache<MiRole[]>(1000 * 60 * 60); // 1h
+ this.roleAssignmentByUserIdCache = new MemoryKVCache<MiRoleAssignment[]>(1000 * 60 * 5); // 5m
this.redisForSub.on('message', this.onMessage);
}