From 72656356091a3df6b7dadf801d78e5b9a5c39b97 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Fri, 21 Jan 2022 02:10:43 +0100 Subject: [PATCH] only log if packages were requeued --- utils.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/utils.go b/utils.go index 3517aa7..df12e54 100644 --- a/utils.go +++ b/utils.go @@ -923,24 +923,31 @@ func logHK() error { } if rePortError.Match(logContent) || reSigError.Match(logContent) || reDownloadError.Match(logContent) { - log.Infof("[HK/%s/%s] fixable build-error detected, requeueing package", pkg.March, pkg.Pkgbase) - err = db.DbPackage.Update().Where(dbpackage.And(dbpackage.Pkgbase(pkg.Pkgbase), dbpackage.March(pkg.March), - dbpackage.StatusEQ(dbpackage.StatusFailed))).ClearHash().SetStatus(dbpackage.StatusQueued).Exec(context.Background()) + rows, err := db.DbPackage.Update().Where(dbpackage.And(dbpackage.Pkgbase(pkg.Pkgbase), dbpackage.March(pkg.March), + dbpackage.StatusEQ(dbpackage.StatusFailed))).ClearHash().SetStatus(dbpackage.StatusQueued).Save(context.Background()) if err != nil { return err } + + if rows > 0 { + log.Infof("[HK/%s/%s] fixable build-error detected, requeueing package (%d)", pkg.March, pkg.Pkgbase, rows) + } } else if reLdError.Match(logContent) { log.Infof("[HK/%s/%s] fixable build-error detected (linker-error), requeueing package", pkg.March, pkg.Pkgbase) - err = db.DbPackage.Update().Where( + rows, err := db.DbPackage.Update().Where( dbpackage.And( dbpackage.Pkgbase(pkg.Pkgbase), dbpackage.March(pkg.March), dbpackage.StatusEQ(dbpackage.StatusFailed), dbpackage.LtoNotIn(dbpackage.LtoAutoDisabled, dbpackage.LtoDisabled), - )).ClearHash().SetStatus(dbpackage.StatusQueued).SetLto(dbpackage.LtoAutoDisabled).Exec(context.Background()) + )).ClearHash().SetStatus(dbpackage.StatusQueued).SetLto(dbpackage.LtoAutoDisabled).Save(context.Background()) if err != nil { return err } + + if rows > 0 { + log.Infof("[HK/%s/%s] fixable build-error detected (linker-error), requeueing package (%d)", pkg.March, pkg.Pkgbase, rows) + } } } return nil