Skip to content

Commit

Permalink
fix go routines leakage (#726)
Browse files Browse the repository at this point in the history
* fix go routines leakage

* Update manager.go

fmt

Co-authored-by: Tim Voronov <[email protected]>
  • Loading branch information
bundleman and ziflex authored Feb 10, 2022
1 parent 0c6d4e6 commit 70a8ef7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/drivers/cdp/network/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,17 +494,16 @@ func (m *Manager) NavigateBack(ctx context.Context, skip values.Int) (values.Boo
}

func (m *Manager) WaitForNavigation(ctx context.Context, opts WaitEventOptions) error {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

stream, err := m.OnNavigation(ctx)

if err != nil {
return err
}

defer stream.Close(ctx)

ctx, cancel := context.WithCancel(ctx)
defer cancel()

for evt := range stream.Read(ctx) {
if err := ctx.Err(); err != nil {
return err
Expand Down

0 comments on commit 70a8ef7

Please sign in to comment.