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:
parent
1d0617eb3b
commit
62a0665a99
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user