Skip to content

Commit 622439d

Browse files
committed
fix: refresh background
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent eae0e47 commit 622439d

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

  • services/libs/data-access-layer/src/members

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,12 @@ export async function queryMembersAdvanced(
248248
if (countOnly && cachedCount !== null) {
249249
log.info(
250250
{ countCacheKey, segmentId, search: normalizedSearch },
251-
'Members advanced count cache hit — returning cached count, scheduling background refresh',
251+
'Members advanced count cache hit — returning cached count',
252252
)
253-
refreshCountCacheInBackground(bgQx, redis, countCacheKey, {
254-
filter,
255-
search: normalizedSearch,
256-
segmentId,
257-
include,
258-
includeAllAttributes,
259-
attributeSettings,
260-
})
253+
// No background refresh for count hits: the count is a single integer with a 6h TTL,
254+
// refreshing it on every hit would fire a COUNT(*) query per request, defeating the cache.
255+
// The count is kept fresh by: (1) full-result refreshes that also write countCacheKey,
256+
// (2) natural TTL expiry, (3) explicit cache invalidation on member updates.
261257
return {
262258
rows: [],
263259
count: cachedCount,

0 commit comments

Comments
 (0)