21 lines
444 B
Go
21 lines
444 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
|
||
|
}
|
||
|
}
|
||
|
}
|