1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-01-08 03:13:15 +02:00

Fix cpu leakage (#635)

This commit is contained in:
Roman 2021-07-17 00:58:11 +03:00 committed by GitHub
parent 1d0617eb3b
commit 62a0665a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -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

View File

@ -58,7 +58,6 @@ func LoadHTMLPage(
}
client := cdp.NewClient(conn)
if err := enableFeatures(ctx, client, params); err != nil {
return nil, err
}
@ -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
}
@ -107,13 +105,10 @@ func LoadHTMLPage(
mouse,
keyboard,
)
if err != nil {
return nil, err
}
closers = append(closers, domManager)
p = NewHTMLPage(
logger,
conn,