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"
"golang.org/x/net/html"
"pault.ag/go/debian/version"
)
func StartPackageQueueWorker(ctx context.Context) {
@ -34,22 +35,34 @@ func StartPackageQueueWorker(ctx context.Context) {
if v.Status == domain.Current {
return true
}
version := v.NewVersion
if version == "" {
version = v.Version
vs := v.NewVersion
if vs == "" {
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
buildVersion = version
buildAttempt = v.BuildAttempts
return false
}
if v.Status == domain.Stale {
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
})
if needsBuild {