Fix error state resetting

This commit is contained in:
ferreo 2024-07-30 08:08:00 +01:00
parent e3593d4321
commit a29d7396ef

View File

@ -43,10 +43,26 @@ func ProcessPackages() error {
ProcessStalePackages(internalPackages, externalPackages) ProcessStalePackages(internalPackages, externalPackages)
ProcessMissingPackages(internalPackages, externalPackages) ProcessMissingPackages(internalPackages, externalPackages)
currentPackagesFastMap.Clear()
internalPackages.ForEach(func(k string, v domain.SourcePackage) bool { internalPackages.ForEach(func(k string, v domain.SourcePackage) bool {
curr, ok := currentPackagesFastMap.Get(k)
if !ok {
currentPackagesFastMap.Set(k, v) currentPackagesFastMap.Set(k, v)
return true return true
}
curr.Packages.ForEach(func(kk string, pk domain.PackageInfo) bool {
v.Packages.ForEach(func(vv string, pv domain.PackageInfo) bool {
if pv.PackageName == pk.PackageName {
if pk.Status == domain.Error {
pv.LastBuildStatus = domain.Error
}
curr.Packages.Set(vv, pv)
}
return true
})
return true
})
currentPackagesFastMap.Set(k, curr)
return true
}) })
LastUpdateTime = time.Now() LastUpdateTime = time.Now()
@ -271,7 +287,9 @@ func ProcessStalePackages(internalPackages *haxmap.Map[string, domain.SourcePack
extVer, _ := version.Parse(newVersion) extVer, _ := version.Parse(newVersion)
cmpVal := version.Compare(mVer, extVer) cmpVal := version.Compare(mVer, extVer)
if cmpVal < 0 { if cmpVal < 0 {
if currentPackage.Status != domain.Error {
currentPackage.Status = domain.Stale currentPackage.Status = domain.Stale
}
currentPackage.NewVersion = extVer.String() currentPackage.NewVersion = extVer.String()
matchedPackage.Packages.Set(currentKey, currentPackage) matchedPackage.Packages.Set(currentKey, currentPackage)
} }
@ -299,6 +317,9 @@ func ProcessStalePackages(internalPackages *haxmap.Map[string, domain.SourcePack
}) })
if wasMissing { if wasMissing {
matchedPackage.Packages.ForEach(func(k string, v domain.PackageInfo) bool { matchedPackage.Packages.ForEach(func(k string, v domain.PackageInfo) bool {
if v.Status == domain.Error {
return true
}
if v.Status == domain.Missing { if v.Status == domain.Missing {
return true return true
} }