satellite/accounting: use AOST to get segment usage

For better performance we should use AOST for getting
data where being up to data it not very crucial. We don't
care about small differences for segment limit calculation.

Change-Id: I9b2d4f2bd15ebc9d1c46bc84dd51a2e9d9231506
This commit is contained in:
Michał Niewrzał 2022-01-21 14:38:31 +01:00 committed by Michal Niewrzal
parent 3451162583
commit 9ce1a4e25d
2 changed files with 3 additions and 0 deletions

View File

@ -220,6 +220,8 @@ func (usage *Service) GetProjectSegments(ctx context.Context, projectID uuid.UUI
total, err := usage.metabaseDB.GetProjectSegmentCount(ctx, metabase.GetProjectSegmentCount{
ProjectID: projectID,
AsOfSystemInterval: usage.asOfSystemInterval,
})
return total, ErrProjectUsage.Wrap(err)
}

View File

@ -243,6 +243,7 @@ func TestProjectSegmentLimitWithoutCache(t *testing.T) {
config.Console.UsageLimits.Segment.Paid = 5
// this effectively disable live accounting cache
config.LiveAccounting.BandwidthCacheTTL = -1
config.LiveAccounting.AsOfSystemInterval = 0
},
},
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {