fix cache call

commit-id:12f02fb8
This commit is contained in:
justinschuldt 2022-02-23 10:53:39 -06:00 committed by Justin Schuldt
parent a7b9e3b7ad
commit e582c872ec
2 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ var skipDays = map[string]bool{
// calcuates a running total of notional value transferred, by symbol, since the start time specified.
func createTvlCumulativeOfInterval(tbl *bigtable.Table, ctx context.Context, start time.Time) map[string]map[string]map[string]LockedAsset {
if len(warmTvlCumulativeCache) == 0 {
loadJsonToInterface(ctx, warmTvlCumulativeCacheFilePath, &muWarmTvlCumulativeCache, &warmTvlCumulativeCache)
loadJsonToInterface(warmTvlCumulativeCacheFilePath, &muWarmTvlCumulativeCache, &warmTvlCumulativeCache)
}
now := time.Now().UTC()
@ -197,7 +197,7 @@ func createTvlCumulativeOfInterval(tbl *bigtable.Table, ctx context.Context, sta
}
if cacheNeedsUpdate {
persistInterfaceToJson(ctx, warmTvlCumulativeCacheFilePath, &muWarmTvlCumulativeCache, warmTvlCumulativeCache)
persistInterfaceToJson(warmTvlCumulativeCacheFilePath, &muWarmTvlCumulativeCache, warmTvlCumulativeCache)
}
// take the most recent n days, rather than returning all days since launch

View File

@ -36,7 +36,7 @@ type LockedAsset struct {
// finds the daily amount of each symbol transferred to each chain, from the specified start to the present.
func tvlInInterval(tbl *bigtable.Table, ctx context.Context, start time.Time) map[string]map[string]map[string]LockedAsset {
if len(warmTvlCache) == 0 {
loadJsonToInterface(ctx, warmTvlFilePath, &muWarmTvlCache, &warmTvlCache)
loadJsonToInterface(warmTvlFilePath, &muWarmTvlCache, &warmTvlCache)
}
results := map[string]map[string]map[string]LockedAsset{}
@ -162,7 +162,7 @@ func tvlInInterval(tbl *bigtable.Table, ctx context.Context, start time.Time) ma
intervalsWG.Wait()
if cacheNeedsUpdate {
persistInterfaceToJson(ctx, warmTvlFilePath, &muWarmTvlCache, warmTvlCache)
persistInterfaceToJson(warmTvlFilePath, &muWarmTvlCache, warmTvlCache)
}
// create a set of all the keys from all dates/chains, to ensure the result objects all have the same chain keys