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