add context cancelation

This commit is contained in:
rocketlaunchr-cto 2020-03-11 16:52:07 +11:00
parent a49cf9470a
commit da80521ed1

View File

@ -102,6 +102,11 @@ func Search(ctx context.Context, searchTerm string, opts ...SearchOptions) ([]Re
sel := e.DOM sel := e.DOM
for i := range sel.Nodes { for i := range sel.Nodes {
if err := ctx.Err(); err != nil {
rErr = err
return
}
item := sel.Eq(i) item := sel.Eq(i)
rDiv := item.Find("div.r") rDiv := item.Find("div.r")