added removing overdue packages

This commit is contained in:
2022-08-13 22:51:43 +02:00
parent c8b31b3275
commit ef61ad7dcf

View File

@@ -5,6 +5,7 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"git.harting.dev/ALHP/ALHP.GO/ent"
"git.harting.dev/ALHP/ALHP.GO/ent/dbpackage"
@@ -121,7 +122,9 @@ func (p *ProtoPackage) isEligible(ctx context.Context) (bool, error) {
log.Infof("Delayed %s: not all dependencies are up to date (local: %s==%s, sync: %s==%s)", p.Srcinfo.Pkgbase, local.Name(), local.Version(), local.Name(), syncVersion)
p.DbPackage.Update().SetSkipReason(fmt.Sprintf("waiting for %s==%s", local.Name(), syncVersion)).ExecX(ctx)
// TODO: purge packages that stay in this state too long
if time.Since(local.BuildDate()).Hours() >= 48 && p.DbPackage.RepoVersion != "" {
return false, errors.New("overdue package waiting")
}
} else {
log.Infof("Delayed %s: not all dependencies are up to date or resolvable", p.Srcinfo.Pkgbase)
p.DbPackage.Update().SetSkipReason("waiting for mirror").ExecX(ctx)