Skip to content

Commit 4c16b08

Browse files
committed
fix: cache regression
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent a170658 commit 4c16b08

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

services/libs/data-access-layer/src/members/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export async function queryMembersAdvanced(
205205
limit,
206206
offset,
207207
orderBy,
208-
search: search || null,
208+
search: search?.trim() || null,
209209
segmentId,
210210
})
211211

services/libs/data-access-layer/src/members/queryCache.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,15 @@ export class MemberQueryCache {
8383
}
8484

8585
async getCount(cacheKey: string): Promise<number | null> {
86-
const cachedCount = await this.countCache.get(cacheKey)
87-
return cachedCount ? parseInt(cachedCount, 10) : null
86+
try {
87+
const cachedCount = await this.countCache.get(cacheKey)
88+
if (!cachedCount) return null
89+
const parsed = parseInt(cachedCount, 10)
90+
return isNaN(parsed) ? null : parsed
91+
} catch (error) {
92+
log.warn('Error retrieving count from cache', { error })
93+
return null
94+
}
8895
}
8996

9097
async setCount(cacheKey: string, count: number, ttlSeconds: number): Promise<void> {

0 commit comments

Comments
 (0)