mirror of
https://github.com/tenox7/wrp.git
synced 2025-02-16 18:30:27 +00:00
create new context on context cancelled
This commit is contained in:
parent
d9381ef71a
commit
92f3cb7aee
13
wrp.go
13
wrp.go
@ -181,9 +181,16 @@ func capture(gourl string, w int64, h int64, s float64, co int, p int64, i bool,
|
||||
chromedp.Nodes("a", &nodes, chromedp.ByQueryAll))
|
||||
|
||||
if err != nil {
|
||||
log.Printf("%s %s", c, err)
|
||||
fmt.Fprintf(out, "<BR>%s<BR>", err)
|
||||
return
|
||||
if err.Error() == "context canceled" {
|
||||
log.Printf("%s Contex cancelled, try again", c)
|
||||
fmt.Fprintf(out, "<BR>%s<BR> -- restarting, try again", err)
|
||||
ctx, cancel = chromedp.NewContext(context.Background())
|
||||
return
|
||||
} else {
|
||||
log.Printf("%s %s", c, err)
|
||||
fmt.Fprintf(out, "<BR>%s<BR>", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("%s Landed on: %s, Nodes: %d\n", c, loc, len(nodes))
|
||||
|
Loading…
x
Reference in New Issue
Block a user