diff --git a/lib/services/email-service.ts b/lib/services/email-service.ts index 0f76b18a..03880aff 100644 --- a/lib/services/email-service.ts +++ b/lib/services/email-service.ts @@ -275,13 +275,9 @@ export async function getEmails( console.log(`Fetching emails for user ${userId}${accountId ? ` account ${accountId}` : ''} in folder ${folder}`); // Try to get from cache first - const cacheKey = accountId - ? `email:list:${userId}:${accountId}:${folder}:${page}:${perPage}:${searchQuery}` - : `email:list:${userId}:${folder}:${page}:${perPage}:${searchQuery}`; - const cached = await getCachedEmailList(userId, accountId || 'default', folder, page, perPage); if (cached) { - console.log(`Using cached email list for ${cacheKey}`); + console.log(`Using cached email list for ${userId}${accountId ? ` account ${accountId}` : ''} in folder ${folder}`); return cached; } @@ -356,7 +352,7 @@ export async function getEmails( mailboxes: await getMailboxes(client) }; - // Cache the result + // Cache the result with the correct accountId await cacheEmailList(userId, accountId || 'default', folder, page, perPage, result); return result;