Update() was broken
This commit is contained in:
parent
b833bceb39
commit
c158f8a58c
10
packages.go
10
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()
|
||||
|
|
Loading…
Reference in New Issue