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