internal/aggregate: implement hourly salt rotation for unique visitors

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I5861c5bb55153349d0710cc07c1595a96a6a6964
This commit is contained in:
raf 2026-03-07 08:28:03 +03:00
commit d975c7b2d1
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 41 additions and 34 deletions

View file

@ -33,7 +33,7 @@ func TestDailySalt(t *testing.T) {
}
func TestUniquesEstimator(t *testing.T) {
estimator := NewUniquesEstimator()
estimator := NewUniquesEstimator("daily")
// Initially should be zero
if count := estimator.Estimate(); count != 0 {
@ -87,7 +87,7 @@ func TestUniquesEstimatorDailyRotation(t *testing.T) {
}
// Verify estimator uses current day's salt
estimator := NewUniquesEstimator()
estimator := NewUniquesEstimator("daily")
currentSalt := estimator.CurrentSalt()
expectedSalt := DailySalt(time.Now())