Эх сурвалжийг харах

任务状态更新;站点信息更新

mxs 1 жил өмнө
parent
commit
de94b8dd21

+ 2 - 2
src/luatask/newtask.go

@@ -726,9 +726,9 @@ func createTask(sp *NewSpider, taskArr *[][]map[string]interface{}, lock *sync.M
 		}
 		//任务状态
 		if state_old == 0 {
-			if sp.ErrType == NEWTASK_LISTERR || sp.ErrType == NEWTASK_DATAINFOERR {
+			if sp.ErrType == NEWTASK_LISTERR || sp.ErrType == NEWTASK_DATAINFOERR { //指定任务类型赋值任务状态待处理
 				result["i_state"] = 1
-			} else if comeintime_old >= util.GetTime(-30) { //在一个月内有历史任务
+			} else if comeintime_old >= util.GetTime(-30) && times_old >= 3 { //在一个月内有历史任务,且第四次建待处理任务
 				result["i_state"] = 1
 			} else {
 				result["l_complete"] = util.CompleteTime("1")

+ 6 - 6
src/timetask/site.go

@@ -163,8 +163,8 @@ func GetPythonSiteLasttime() {
 
 func GetSiteDownloadNum() {
 	defer qu.Catch()
-	sess := util.MgoEB.GetMgoConn()
-	defer util.MgoEB.DestoryMongoConn(sess)
+	sess := util.MgoS.GetMgoConn()
+	defer util.MgoS.DestoryMongoConn(sess)
 	ch := make(chan bool, 5)
 	wg := &sync.WaitGroup{}
 	lock := &sync.Mutex{}
@@ -174,10 +174,10 @@ func GetSiteDownloadNum() {
 		},
 	}
 	fields := map[string]interface{}{
-		"site":              1,
-		"repeatptimeallnum": 1,
+		"site":                      1,
+		"detail_downloadsuccessnum": 1,
 	}
-	it := sess.DB(util.MgoEB.DbName).C("luacodeinfo").Find(&query).Select(&fields).Iter()
+	it := sess.DB(util.MgoS.DbName).C("spider_info").Find(&query).Select(&fields).Iter()
 	n := 0
 	for tmp := make(map[string]interface{}); it.Next(tmp); n++ {
 		ch <- true
@@ -188,7 +188,7 @@ func GetSiteDownloadNum() {
 				wg.Done()
 			}()
 			site := qu.ObjToString(tmp["site"])
-			num := qu.IntAll(tmp["repeatptimeallnum"])
+			num := qu.IntAll(tmp["detail_downloadsuccessnum"])
 			lock.Lock()
 			if sInfo := siteMap[site]; sInfo != nil {
 				sInfo.DownloadNum += num