From 4cb13df34ff31e407c4d9d165a09fd7cf1638dc1 Mon Sep 17 00:00:00 2001 From: DirkSchlossmacher <62424946+DirkSchlossmacher@users.noreply.github.com> Date: Tue, 14 Nov 2023 13:03:33 +0100 Subject: [PATCH] redisRestClient rework --- app/utils/cloud/redisRestClient.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/app/utils/cloud/redisRestClient.ts b/app/utils/cloud/redisRestClient.ts index 750084743..3a682d4e0 100644 --- a/app/utils/cloud/redisRestClient.ts +++ b/app/utils/cloud/redisRestClient.ts @@ -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 => { if (!email) { console.error('Email is undefined, cannot increment sign-in count.'); - return; + return; // This is fine for a function returning Promise } const redis = getRedisClient(); if (!redis) { console.error('Redis client is not initialized.'); - return; + return; // This is fine for a function returning Promise } 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 => { if (!email) { console.error('Email is undefined, cannot increment session refresh count.'); - return; + return; // This is fine for a function returning Promise } const redis = getRedisClient(); if (!redis) { console.error('Redis client is not initialized.'); - return; + return; // This is fine for a function returning Promise } 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 => { const redis = getRedisClient(); if (!redis) { console.error('Redis client is not initialized.'); - return; + return []; // Return an empty array explicitly } try { @@ -139,9 +146,9 @@ export const getDetailsByUser = async (dateKey: string): Promise = {};