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 {
if v.BuildAttempts > 0 {
buildAttempt = v.BuildAttempts
}
}
if v.Status == domain.Missing || v.Status == domain.Stale {
needsBuild = true needsBuild = true
buildVersion = version
buildAttempt = v.BuildAttempts
return false
} }
if v.Status == domain.Stale { if buildVersion == "" {
needsBuild = true buildVersion = vs
buildVersion = version } else {
buildAttempt = v.BuildAttempts ver, err := version.Parse(buildVersion)
return false 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 {