maxiaoshan 3 жил өмнө
parent
commit
18d3bd8924

+ 6 - 1
src/spider/handler.go

@@ -212,10 +212,12 @@ func QueueUpScriptDetail() {
 			IncludeGoStackTrace: false,
 		})
 	}
+	count_ok, count_no := 0, 0
 	for {
 		logger.Warn(time.Now().Format(qu.Date_Full_Layout), ":下载三级页执行死循环", "初始化脚本数量:", InitCount)
 		LoopListPath.Range(func(key, temp interface{}) bool {
 			if info, ok := temp.(map[string]string); ok {
+				count_ok++
 				code := info["code"]
 				old_is_running := false
 				tmp, b := Allspiders2.Load(code)
@@ -226,6 +228,7 @@ func QueueUpScriptDetail() {
 						}
 					}
 				}
+				logger.Info("Code:", code, "Is Downloading Detail:", old_is_running)
 				if !old_is_running { //判断当前爬虫是否正在执行
 					script := info["script"]
 					sp := NewSpider_New(code, script, true)
@@ -243,12 +246,14 @@ func QueueUpScriptDetail() {
 						go sp.DownloadListDetail() //下载三级页信息
 					}
 				}
+			} else {
+				count_no++
 			}
 			time.Sleep(1 * time.Second)
 			return true
 		})
 		time.Sleep(1 * time.Second)
-		logger.Warn(time.Now().Format(qu.Date_Full_Layout), ":下载三级页执行死循环,完毕")
+		logger.Warn(time.Now().Format(qu.Date_Full_Layout), ":下载三级页执行死循环完毕,数量统计:", count_ok, count_no)
 	}
 }
 

+ 1 - 1
src/spider/spider.go

@@ -584,7 +584,7 @@ func GetListDataDownloadDetail() {
 func (s *Spider) DownloadHighDetail() {
 	defer qu.Catch()
 	for {
-		//logger.Info("爬虫代码:", s.Code, "已下架:", s.Stop)
+		logger.Info("Running Code:", s.Code, "Stop:", s.Stop)
 		if !s.Stop { //爬虫是运行状态
 			q := map[string]interface{}{
 				"spidercode": s.Code,