Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 committed Jun 1, 2024
1 parent 03ed97e commit a330f9a
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions pkg/pipeline/source/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"net/url"
"os/exec"
"strings"
"syscall"
"time"

"github.com/chromedp/cdproto/runtime"
Expand Down Expand Up @@ -211,7 +210,6 @@ func (s *WebSource) launchChrome(ctx context.Context, p *config.PipelineConfig,
chromedp.Flag("disable-infobars", true),
chromedp.Flag("excludeSwitches", "enable-automation"),
chromedp.Flag("disable-background-networking", true),
chromedp.Flag("enable-crashpad", false),
chromedp.Flag("enable-features", "NetworkService,NetworkServiceInProcess"),
chromedp.Flag("disable-background-timer-throttling", true),
chromedp.Flag("disable-backgrounding-occluded-windows", true),
Expand Down Expand Up @@ -259,16 +257,8 @@ func (s *WebSource) launchChrome(ctx context.Context, p *config.PipelineConfig,
allocCtx, allocCancel := chromedp.NewExecAllocator(context.Background(), opts...)
chromeCtx, chromeCancel := chromedp.NewContext(allocCtx)
s.closeChrome = func() {
defer allocCancel()
defer chromeCancel()

chromeProcess := chromedp.FromContext(chromeCtx).Browser.Process()
if err := chromeProcess.Signal(syscall.SIGTERM); err != nil {
logger.Errorw("failed to kill chrome", err)
}
if _, err := chromeProcess.Wait(); err != nil {
logger.Errorw("failed to wait for chrome", err)
}
chromeCancel()
allocCancel()
}

chromedp.ListenTarget(chromeCtx, func(ev interface{}) {
Expand Down Expand Up @@ -338,8 +328,6 @@ func (s *WebSource) launchChrome(ctx context.Context, p *config.PipelineConfig,
return errors.ErrPageLoadFailed(errString)
}

chromedp.FromContext(chromeCtx)

return nil
}

Expand Down

0 comments on commit a330f9a

Please sign in to comment.