summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-15 19:25:53 -0600
committerJeff Carr <[email protected]>2024-11-15 19:25:53 -0600
commitc158f8a58c5b9cf9cd8f320d239f49c44668eab9 (patch)
tree1f486a256e110a3cb1f25facfbbcff33b41e7e44
parentb833bceb393bd0b7e8ee010e7d5cd8be3be370a0 (diff)
Update() was broken
-rw-r--r--packages.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/packages.go b/packages.go
index fd21396..0dead0a 100644
--- a/packages.go
+++ b/packages.go
@@ -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()