PKGBUILD/pkg/internal/collect/measuredValues.go
Markus Pesch dbef4f8241
fix(pkg/config): use storage endpoints
changes:
- Only one storage endpoint can be defined. This consists of a URL which
  can be used to specify whether the data is to be stored in a file or
  in a database.
2019-12-08 12:49:21 +01:00

21 lines
447 B
Go

package collect
import (
"github.com/go-flucky/flucky/pkg/types"
)
func MeasuredValues(measuredValueChannel <-chan *types.MeasuredValue) []*types.MeasuredValue {
cachedMeasuredValues := make([]*types.MeasuredValue, 0)
for {
select {
case measuredValue, more := <-measuredValueChannel:
if more {
cachedMeasuredValues = append(cachedMeasuredValues, measuredValue)
continue
}
default:
return cachedMeasuredValues
}
}
}