From 4799b0f7b49c36b0eeff9e9b20115028a95ed7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Musab=20G=C3=BCltekin?= Date: Fri, 14 Jun 2019 17:30:49 +0300 Subject: [PATCH] Fixed goroutine leaks. Updated travis build --- .travis.yml | 2 +- geziyor.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ae3698..c63c570 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.12.x + - 1.11.x - tip before_install: diff --git a/geziyor.go b/geziyor.go index a86ea29..05da58c 100644 --- a/geziyor.go +++ b/geziyor.go @@ -112,7 +112,6 @@ func (g *Geziyor) Start() { g.Opt.StartRequestsFunc(g) } - time.Sleep(time.Millisecond) g.wg.Wait() log.Println("Scraping Finished") @@ -206,7 +205,9 @@ func (g *Geziyor) do(req *Request, callback func(resp *Response)) { g.Opt.ParseFunc(response) } } - time.Sleep(time.Millisecond) + + // Close exports chan to prevent goroutine leak + close(response.Exports) } func (g *Geziyor) doRequestClient(req *Request) (*Response, error) {