Update() was broken

This commit is contained in:
Jeff Carr 2024-11-15 19:25:53 -06:00
parent b833bceb39
commit c158f8a58c
1 changed files with 4 additions and 6 deletions

View File

@ -89,8 +89,8 @@ func (r *Packages) Append(newP *Package) bool {
}
// Update version and timestamp.
// returns (ok, changed)
func (r *Packages) Update(newP *Package) (bool, bool) {
// returns ok (ok == true if not found)
func (r *Packages) Update(newP *Package) bool {
lock.Lock()
defer lock.Unlock()
@ -102,7 +102,7 @@ func (r *Packages) Update(newP *Package) (bool, bool) {
}
if found == nil {
// r.Append(newP) // update here?
return false, true
return true
}
var changed bool = false
@ -113,9 +113,7 @@ func (r *Packages) Update(newP *Package) (bool, bool) {
now := time.Now()
found.Laststamp = timestamppb.New(now)
r.Packages = append(r.Packages, newP)
return true, changed
return changed
}
// returns time.Duration since last Update()