From 7c28490157306da6002853b47722cc52c52288f2 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sat, 3 Jul 2021 22:02:40 +0200 Subject: [PATCH] avoid division by zero --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index c6145b8..d1277a8 100644 --- a/main.go +++ b/main.go @@ -658,7 +658,9 @@ func (b *BuildManager) syncWorker() { } b.parseWG.Wait() - log.Infof("Processed source-repos. %d packages elegible to be build, %d already fully build. Covering %f of offical-repo (buildable) packages.", b.stats.eligible, b.stats.fullyBuild, float32(b.stats.fullyBuild)/float32(b.stats.eligible)*100.0) + if b.stats.eligible != 0 { + log.Infof("Processed source-repos. %d packages elegible to be build, %d already fully build. Covering %f of offical-repo (buildable) packages.", b.stats.eligible, b.stats.fullyBuild, float32(b.stats.fullyBuild)/float32(b.stats.eligible)*100.0) + } b.stats.fullyBuild = 0 b.stats.eligible = 0 time.Sleep(5 * time.Minute) @@ -696,6 +698,10 @@ func main() { exit: false, buildWG: sync.WaitGroup{}, failedMutex: sync.RWMutex{}, + stats: struct { + fullyBuild int + eligible int + }{fullyBuild: 0, eligible: 0}, } setupChroot()