More error handling fixes

This commit is contained in:
ferreo 2024-07-30 08:34:00 +01:00
parent ec9bfa5ece
commit eaae782180

View File

@ -12,6 +12,7 @@ import (
"time" "time"
"golang.org/x/net/html" "golang.org/x/net/html"
"pault.ag/go/debian/version"
) )
func StartPackageQueueWorker(ctx context.Context) { func StartPackageQueueWorker(ctx context.Context) {
@ -34,22 +35,34 @@ func StartPackageQueueWorker(ctx context.Context) {
if v.Status == domain.Current { if v.Status == domain.Current {
return true return true
} }
version := v.NewVersion vs := v.NewVersion
if version == "" { if vs == "" {
version = v.Version vs = v.Version
} }
if v.Status == domain.Missing { if v.LastBuildStatus == domain.Error {
needsBuild = true if v.BuildAttempts > 0 {
buildVersion = version
buildAttempt = v.BuildAttempts buildAttempt = v.BuildAttempts
return false
} }
if v.Status == domain.Stale { }
if v.Status == domain.Missing || v.Status == domain.Stale {
needsBuild = true needsBuild = true
buildVersion = version
buildAttempt = v.BuildAttempts
return false
} }
if buildVersion == "" {
buildVersion = vs
} else {
ver, err := version.Parse(buildVersion)
if err != nil {
return true
}
vsVer, err := version.Parse(vs)
if err != nil {
return true
}
if version.Compare(ver, vsVer) < 0 {
buildVersion = vs
}
}
return true return true
}) })
if needsBuild { if needsBuild {