cloud_functions: totals cache should be overwritten for skipDates (#1147)
This commit is contained in:
parent
ec87530bac
commit
3023b4a375
|
@ -153,14 +153,15 @@ func createCountsOfInterval(tbl *bigtable.Table, ctx context.Context, prefix str
|
||||||
results[dateStr][countBy] = results[dateStr][countBy] + 1
|
results[dateStr][countBy] = results[dateStr][countBy] + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if cacheData, ok := warmTotalsCache[dateStr][cachePrefix]; !ok || len(cacheData) <= 1 {
|
if daysAgo >= 1 {
|
||||||
// set the result in the cache
|
|
||||||
muWarmTotalsCache.Lock()
|
muWarmTotalsCache.Lock()
|
||||||
warmTotalsCache[dateStr][cachePrefix] = results[dateStr]
|
if cacheData, ok := warmTotalsCache[dateStr][cachePrefix]; !ok || len(cacheData) <= 1 || !useCache(dateStr) {
|
||||||
|
// set the result in the cache
|
||||||
|
warmTotalsCache[dateStr][cachePrefix] = results[dateStr]
|
||||||
|
cacheNeedsUpdate = true
|
||||||
|
}
|
||||||
muWarmTotalsCache.Unlock()
|
muWarmTotalsCache.Unlock()
|
||||||
cacheNeedsUpdate = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}(tbl, ctx, prefix, daysAgo)
|
}(tbl, ctx, prefix, daysAgo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue