From e876fd082348f3d35752b461db9fe575782b0b76 Mon Sep 17 00:00:00 2001 From: xing Date: Sat, 27 Aug 2022 21:30:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 8f8abf6..f7e0bf7 100644 --- a/main.go +++ b/main.go @@ -168,14 +168,17 @@ func (f *fetchHandler) handle(conn string) { } for _, sourceName := range (*f.searchSource.mapX)[conn] { source := f.sourceMap[sourceName] - r := f.fetch2(source, key) - if r != nil && r.StatusCode == 200 { - if strings.ToUpper(source.Type) == "HTML" { - f.parsesDom(r, conn, source) - } else { - f.parseAjax(r, source, conn) + go func() { + r := f.fetch2(source, key) + if r != nil && r.StatusCode == 200 { + if strings.ToUpper(source.Type) == "HTML" { + f.parsesDom(r, conn, source) + } else { + f.parseAjax(r, source, conn) + } } - } + }() + } }