maxiaoshan 3 gadi atpakaļ
vecāks
revīzija
5f518aa8bc
1 mainītis faili ar 10 papildinājumiem un 3 dzēšanām
  1. 10 3
      src/spider/handler.go

+ 10 - 3
src/spider/handler.go

@@ -135,7 +135,7 @@ func QueueUpScriptList() {
 		})
 	}
 	for {
-		listLen, DelLen := 0, 0
+		listLen, listNoLen, DelLen := 0, 0, 0
 		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 {
@@ -149,6 +149,7 @@ func QueueUpScriptList() {
 						}
 					}
 				}
+				logger.Info("Code:", code, "Is Downloading List:", old_is_running)
 				if !old_is_running { //判断当前爬虫是否正在执行
 					script := info["script"]
 					sp := NewSpider_New(code, script, false)
@@ -182,6 +183,9 @@ func QueueUpScriptList() {
 					}
 				}
 				listLen++
+			} else {
+				logger.Info("Code:", code, "Is Not Download List")
+				listNoLen++
 			}
 			time.Sleep(1 * time.Second)
 			return true
@@ -196,7 +200,8 @@ func QueueUpScriptList() {
 			}
 			return true
 		})
-		logger.Warn(time.Now().Format(qu.Date_Full_Layout), ":下载列表页执行死循环,列表长度,", listLen, "删除数量", DelLen, "执行完毕后数量统计:", count_ok, count_no)
+		InitCount = count_ok
+		logger.Warn(time.Now().Format(qu.Date_Full_Layout), ":下载列表页执行死循环,列表长度,", listLen, listNoLen, "删除数量", DelLen, "执行完毕后数量统计:", count_ok, count_no)
 	}
 }
 
@@ -212,8 +217,8 @@ func QueueUpScriptDetail() {
 			IncludeGoStackTrace: false,
 		})
 	}
-	count_ok, count_no := 0, 0
 	for {
+		count_ok, count_no := 0, 0
 		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 {
@@ -247,11 +252,13 @@ func QueueUpScriptDetail() {
 					}
 				}
 			} else {
+				logger.Info("Code:", code, "Is Not Download Detail")
 				count_no++
 			}
 			time.Sleep(1 * time.Second)
 			return true
 		})
+		InitCount = count_ok
 		time.Sleep(1 * time.Second)
 		logger.Warn(time.Now().Format(qu.Date_Full_Layout), ":下载三级页执行死循环完毕,数量统计:", count_ok, count_no)
 	}