feat: add member cache; handle all role changes with RoleManagerPlugin; exit gracefully
This commit is contained in:
parent
fd60a09947
commit
fa50110766
48 changed files with 755 additions and 264 deletions
13
backend/src/data/loops/expiredMemberCacheDeletionLoop.ts
Normal file
13
backend/src/data/loops/expiredMemberCacheDeletionLoop.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
// tslint:disable:no-console
|
||||
|
||||
import { HOURS, lazyMemoize } from "../../utils";
|
||||
import { MemberCache } from "../MemberCache";
|
||||
|
||||
const LOOP_INTERVAL = 6 * HOURS;
|
||||
const getMemberCacheRepository = lazyMemoize(() => new MemberCache());
|
||||
|
||||
export async function runExpiredMemberCacheDeletionLoop() {
|
||||
console.log("[EXPIRED MEMBER CACHE DELETION LOOP] Deleting stale member cache entries");
|
||||
await getMemberCacheRepository().deleteStaleData();
|
||||
setTimeout(() => runExpiredMemberCacheDeletionLoop(), LOOP_INTERVAL);
|
||||
}
|
13
backend/src/data/loops/memberCacheDeletionLoop.ts
Normal file
13
backend/src/data/loops/memberCacheDeletionLoop.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
// tslint:disable:no-console
|
||||
|
||||
import { lazyMemoize, MINUTES } from "../../utils";
|
||||
import { MemberCache } from "../MemberCache";
|
||||
|
||||
const LOOP_INTERVAL = 5 * MINUTES;
|
||||
const getMemberCacheRepository = lazyMemoize(() => new MemberCache());
|
||||
|
||||
export async function runMemberCacheDeletionLoop() {
|
||||
console.log("[MEMBER CACHE DELETION LOOP] Deleting entries marked to be deleted");
|
||||
await getMemberCacheRepository().deleteMarkedToBeDeletedEntries();
|
||||
setTimeout(() => runMemberCacheDeletionLoop(), LOOP_INTERVAL);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue