1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-01-10 03:16:58 +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( func New(
ctx context.Context,
logger *zerolog.Logger, logger *zerolog.Logger,
client *cdp.Client, client *cdp.Client,
options Options, options Options,
) (*Manager, error) { ) (*Manager, error) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(ctx)
m := new(Manager) m := new(Manager)
m.logger = logger m.logger = logger

View File

@ -58,7 +58,6 @@ func LoadHTMLPage(
} }
client := cdp.NewClient(conn) client := cdp.NewClient(conn)
if err := enableFeatures(ctx, client, params); err != nil { if err := enableFeatures(ctx, client, params); err != nil {
return nil, err return nil, err
} }
@ -92,8 +91,7 @@ func LoadHTMLPage(
netOpts.Filter.Patterns = params.Ignore.Resources netOpts.Filter.Patterns = params.Ignore.Resources
} }
netManager, err := net.New(logger, client, netOpts) netManager, err := net.New(ctx, logger, client, netOpts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -107,13 +105,10 @@ func LoadHTMLPage(
mouse, mouse,
keyboard, keyboard,
) )
if err != nil { if err != nil {
return nil, err return nil, err
} }
closers = append(closers, domManager)
p = NewHTMLPage( p = NewHTMLPage(
logger, logger,
conn, conn,