From e25771e511cffa856c1d8e6fd90a67fb000a2873 Mon Sep 17 00:00:00 2001 From: Gareth George Date: Tue, 26 Dec 2023 08:40:11 +0000 Subject: [PATCH] fix: stat never runs --- internal/orchestrator/taskstats.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/orchestrator/taskstats.go b/internal/orchestrator/taskstats.go index 08fd1157..7fbaeae8 100644 --- a/internal/orchestrator/taskstats.go +++ b/internal/orchestrator/taskstats.go @@ -39,7 +39,7 @@ func (t *StatsTask) Name() string { } func (t *StatsTask) shouldRun() (bool, error) { - var bytesSinceLastStat int64 + var bytesSinceLastStat int64 = -1 if err := t.orch.OpLog.ForEachByRepo(t.plan.Repo, indexutil.CollectLastN(50), func(op *v1.Operation) error { if _, ok := op.Op.(*v1.Operation_OperationStats); ok { bytesSinceLastStat = 0 @@ -55,7 +55,7 @@ func (t *StatsTask) shouldRun() (bool, error) { zap.L().Debug("bytes since last stat", zap.Int64("bytes", bytesSinceLastStat), zap.String("repo", t.plan.Repo)) - if bytesSinceLastStat > statBytesThreshold { + if bytesSinceLastStat == -1 || bytesSinceLastStat > statBytesThreshold { zap.S().Debugf("bytes since last stat (%v) exceeds threshold (%v)", bytesSinceLastStat, statBytesThreshold) return true, nil }