Evacuate data appropriately
this breaks the tests; tests need to not rely on some weird date in the past.
This commit is contained in:
parent
63547f2d37
commit
c33a5561bb
@ -128,8 +128,9 @@ func (s *stream) averages() []float64 {
|
|||||||
if s.data.Back() == nil {
|
if s.data.Back() == nil {
|
||||||
return totals
|
return totals
|
||||||
}
|
}
|
||||||
newest := s.data.Back().Value.(datum)
|
|
||||||
cutoff := newest.at.Add(s.max)
|
now := time.Now()
|
||||||
|
cutoff := now.Add(s.max)
|
||||||
for e := s.data.Front(); e != nil; e = e.Next() {
|
for e := s.data.Front(); e != nil; e = e.Next() {
|
||||||
cur := e.Value.(datum).at
|
cur := e.Value.(datum).at
|
||||||
if cur.Before(cutoff) {
|
if cur.Before(cutoff) {
|
||||||
@ -142,7 +143,7 @@ func (s *stream) averages() []float64 {
|
|||||||
e := s.data.Back()
|
e := s.data.Back()
|
||||||
|
|
||||||
for _, extent := range s.extents {
|
for _, extent := range s.extents {
|
||||||
limit = newest.at.Add(extent)
|
limit = now.Add(extent)
|
||||||
for ; e != nil; e = e.Prev() {
|
for ; e != nil; e = e.Prev() {
|
||||||
if e.Prev() == nil {
|
if e.Prev() == nil {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user