2019-06-25 20:22:34 +00:00
|
|
|
package collect
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/go-flucky/flucky/pkg/types"
|
|
|
|
)
|
|
|
|
|
2019-07-02 20:33:01 +00:00
|
|
|
func MeasuredValues(measuredValuesChannel <-chan []*types.MeasuredValue) []*types.MeasuredValue {
|
|
|
|
cachedMeasuredValues := make([]*types.MeasuredValue, 0)
|
2019-06-25 20:22:34 +00:00
|
|
|
for {
|
|
|
|
select {
|
2019-06-27 07:31:40 +00:00
|
|
|
case measuredValues, more := <-measuredValuesChannel:
|
2019-06-25 20:22:34 +00:00
|
|
|
if more {
|
2019-06-27 07:31:40 +00:00
|
|
|
cachedMeasuredValues = append(cachedMeasuredValues, measuredValues...)
|
2019-06-25 20:22:34 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return cachedMeasuredValues
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|