diff options
Diffstat (limited to 'internal/flamegraph')
| -rw-r--r-- | internal/flamegraph/worker.go | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/internal/flamegraph/worker.go b/internal/flamegraph/worker.go index 534bfc3..0f49568 100644 --- a/internal/flamegraph/worker.go +++ b/internal/flamegraph/worker.go @@ -4,7 +4,6 @@ import ( "context" "ior/internal/event" "sync" - "time" ) type worker struct { @@ -21,17 +20,14 @@ func (w worker) run(ctx context.Context, wg *sync.WaitGroup, ch <-chan *event.Pa for { select { - case ev := <-ch: - w.iod.addEventPair(ev) - ev.Recycle() - - default: - select { - case <-ctx.Done(): + case ev, ok := <-ch: + if !ok { return - default: - time.Sleep(time.Millisecond * 10) } + w.iod.addEventPair(ev) + ev.Recycle() + case <-ctx.Done(): + return } } } |
