Skip to content

Commit

Permalink
fix(tracker): more flexible channel return
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Dec 17, 2023
1 parent 2c53790 commit 5b890f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/tracker/sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,17 @@ func marshalClass[C ComparableStringer](class C) string {
}
}

func MergeSensorCh(ctx context.Context, sensorCh ...<-chan Sensor) <-chan Sensor {
func MergeSensorCh(ctx context.Context, sensorCh ...<-chan Sensor) chan Sensor {
var wg sync.WaitGroup
out := make(chan Sensor)

// Start an output goroutine for each input channel in sensorCh. output
// copies values from c to out until c is closed, then calls wg.Done.
output := func(c <-chan Sensor) {
defer wg.Done()
if c == nil {
return
}
for n := range c {
select {
case out <- n:
Expand Down

0 comments on commit 5b890f1

Please sign in to comment.