mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-08 19:16:37 +08:00
redisRestClient rework
This commit is contained in:
parent
c93d001be5
commit
4cb13df34f
@ -24,16 +24,19 @@ const getRedisClient = () => {
|
||||
|
||||
|
||||
|
||||
export const incrementSignInCount = async (email: string | undefined, dateKey: string) => {
|
||||
export const incrementSignInCount = async (
|
||||
email: string | undefined,
|
||||
dateKey: string
|
||||
): Promise<void> => {
|
||||
if (!email) {
|
||||
console.error('Email is undefined, cannot increment sign-in count.');
|
||||
return;
|
||||
return; // This is fine for a function returning Promise<void>
|
||||
}
|
||||
|
||||
const redis = getRedisClient();
|
||||
if (!redis) {
|
||||
console.error('Redis client is not initialized.');
|
||||
return;
|
||||
return; // This is fine for a function returning Promise<void>
|
||||
}
|
||||
|
||||
try {
|
||||
@ -43,16 +46,19 @@ export const incrementSignInCount = async (email: string | undefined, dateKey: s
|
||||
}
|
||||
};
|
||||
|
||||
export const incrementSessionRefreshCount = async (email: string | undefined, dateKey: string) => {
|
||||
export const incrementSessionRefreshCount = async (
|
||||
email: string | undefined,
|
||||
dateKey: string
|
||||
): Promise<void> => {
|
||||
if (!email) {
|
||||
console.error('Email is undefined, cannot increment session refresh count.');
|
||||
return;
|
||||
return; // This is fine for a function returning Promise<void>
|
||||
}
|
||||
|
||||
const redis = getRedisClient();
|
||||
if (!redis) {
|
||||
console.error('Redis client is not initialized.');
|
||||
return;
|
||||
return; // This is fine for a function returning Promise<void>
|
||||
}
|
||||
|
||||
try {
|
||||
@ -62,6 +68,7 @@ export const incrementSessionRefreshCount = async (email: string | undefined, da
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const incrementTokenCounts = async (
|
||||
email: string | undefined,
|
||||
dateKey: string,
|
||||
@ -93,7 +100,7 @@ export const getAvailableDateKeys = async (): Promise<string[]> => {
|
||||
const redis = getRedisClient();
|
||||
if (!redis) {
|
||||
console.error('Redis client is not initialized.');
|
||||
return;
|
||||
return []; // Return an empty array explicitly
|
||||
}
|
||||
|
||||
try {
|
||||
@ -139,7 +146,7 @@ export const getDetailsByUser = async (dateKey: string): Promise<Record<string,
|
||||
const redis = getRedisClient();
|
||||
if (!redis) {
|
||||
console.error('Redis client is not initialized.');
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user