Skip to content

Commit

Permalink
Fix cpu leakage (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
bundleman authored Jul 16, 2021
1 parent 1d0617e commit 62a0665
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pkg/drivers/cdp/network/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ type (
)

func New(
ctx context.Context,
logger *zerolog.Logger,
client *cdp.Client,
options Options,
) (*Manager, error) {
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(ctx)

m := new(Manager)
m.logger = logger
Expand Down
7 changes: 1 addition & 6 deletions pkg/drivers/cdp/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func LoadHTMLPage(
}

client := cdp.NewClient(conn)

if err := enableFeatures(ctx, client, params); err != nil {
return nil, err
}
Expand Down Expand Up @@ -92,8 +91,7 @@ func LoadHTMLPage(
netOpts.Filter.Patterns = params.Ignore.Resources
}

netManager, err := net.New(logger, client, netOpts)

netManager, err := net.New(ctx, logger, client, netOpts)
if err != nil {
return nil, err
}
Expand All @@ -107,13 +105,10 @@ func LoadHTMLPage(
mouse,
keyboard,
)

if err != nil {
return nil, err
}

closers = append(closers, domManager)

p = NewHTMLPage(
logger,
conn,
Expand Down

0 comments on commit 62a0665

Please sign in to comment.