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