'
This commit is contained in:
@@ -16,27 +16,22 @@ type PayjsVipResult = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const inflightUserChecks = new Map<string, Promise<PayjsVipResult | null>>();
|
const inflightUserChecks = new Map<string, Promise<PayjsVipResult | null>>();
|
||||||
|
type UserCheckPayload = {
|
||||||
|
ok: boolean;
|
||||||
|
vip: boolean;
|
||||||
|
alreadyLinked: boolean;
|
||||||
|
email?: string;
|
||||||
|
linkedUserId?: string;
|
||||||
|
};
|
||||||
const inflightUserRequests = new Map<
|
const inflightUserRequests = new Map<
|
||||||
string,
|
string,
|
||||||
Promise<{
|
Promise<UserCheckPayload>
|
||||||
ok: true;
|
|
||||||
vip: boolean;
|
|
||||||
alreadyLinked: boolean;
|
|
||||||
email?: string;
|
|
||||||
linkedUserId?: string;
|
|
||||||
}>
|
|
||||||
>();
|
>();
|
||||||
const userCheckResultCache = new Map<
|
const userCheckResultCache = new Map<
|
||||||
string,
|
string,
|
||||||
{
|
{
|
||||||
expiresAt: number;
|
expiresAt: number;
|
||||||
payload: {
|
payload: UserCheckPayload;
|
||||||
ok: true;
|
|
||||||
vip: boolean;
|
|
||||||
alreadyLinked: boolean;
|
|
||||||
email?: string;
|
|
||||||
linkedUserId?: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
>();
|
>();
|
||||||
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user