This commit is contained in:
eric
2026-03-26 11:41:00 -05:00
parent 11ea8d402c
commit a8976b2eee

View File

@@ -16,27 +16,22 @@ type PayjsVipResult = {
}; };
const inflightUserChecks = new Map<string, Promise<PayjsVipResult | null>>(); const inflightUserChecks = new Map<string, Promise<PayjsVipResult | null>>();
const inflightUserRequests = new Map< type UserCheckPayload = {
string, ok: boolean;
Promise<{
ok: true;
vip: boolean;
alreadyLinked: boolean;
email?: string;
linkedUserId?: string;
}>
>();
const userCheckResultCache = new Map<
string,
{
expiresAt: number;
payload: {
ok: true;
vip: boolean; vip: boolean;
alreadyLinked: boolean; alreadyLinked: boolean;
email?: string; email?: string;
linkedUserId?: string; linkedUserId?: string;
}; };
const inflightUserRequests = new Map<
string,
Promise<UserCheckPayload>
>();
const userCheckResultCache = new Map<
string,
{
expiresAt: number;
payload: UserCheckPayload;
} }
>(); >();
const USER_CHECK_CACHE_TTL_MS = Number(process.env.CHECK_BY_USER_CACHE_TTL_MS) || 10_000; const USER_CHECK_CACHE_TTL_MS = Number(process.env.CHECK_BY_USER_CACHE_TTL_MS) || 10_000;