Kaynağa Gözat

正式配置,定时任务

apple 5 yıl önce
ebeveyn
işleme
92af328c50
1 değiştirilmiş dosya ile 7 ekleme ve 30 silme
  1. 7 30
      udpfilterdup/src/main.go

+ 7 - 30
udpfilterdup/src/main.go

@@ -663,30 +663,14 @@ func timedTaskOnce() {
 	task_sid := util.BsonIdToSId(bson.NewObjectIdWithTime(preTime))
 	task_eid := util.BsonIdToSId(bson.NewObjectIdWithTime(curTime))
 
+	//发布时间间隔时间 半年
 
-	/*ObjectId("5da3f2c5a5cb26b9b79847fc")
-	ObjectId("5db2735ba5cb26b9b7c99c6f")
-	task_sid = "5da3f31aa5cb26b9b798d3aa"
-	task_eid = "5da418c4a5cb26b9b7e3e9a6"
-
-	*/
-	//task_sid = "5da3f2c5a5cb26b9b79847fc"
-	//task_eid = "5db2735ba5cb26b9b7c99c6f"
-	//between_time := int64(1331898261)
-
-	/*
-	ObjectId("5e20965785a9271abf0ad6bd")
-	ObjectId("5e20968d85a9271abf0ad6c2")
-	ObjectId("5e20965785a9271abf0ad6bd")
-	*/
-
-
-	task_sid = "5e20965785a9271abf0ad6bd"
-	task_eid = "5e20968d85a9271abf0ad6c2"
-	between_time := int64(1565801997)
 
-	//发布时间间隔时间 半年
-	//between_time := curTime.Unix()-(86400*timingPubScope)
+	//测试数据
+	//task_sid = "5e20965785a9271abf0ad6bd"
+	//task_eid = "5e20968d85a9271abf0ad6c2"
+	//between_time := int64(1565801997)
+	between_time := curTime.Unix()-(86400*timingPubScope)
 	lasttime := int64(0)
 	log.Println(task_sid, task_eid,curTime.Unix(),between_time)
 	//区间id
@@ -725,8 +709,6 @@ func timedTaskOnce() {
 	//构建第一条需要判重的数据   (数据池)
 	log.Println("开始构建第一条需要判重的数据 ---(数据池)")
 	DM = TimedTaskDatamap(dupdays,lasttime)
-
-
 	sess := mgo.GetMgoConn()
 	defer mgo.DestoryMongoConn(sess)
 
@@ -736,13 +718,9 @@ func timedTaskOnce() {
 			"$lte": StringTOBsonId(task_eid),
 		},
 	}
-
-	log.Println("正式判重:",q)
 	it := sess.DB(mgo.DbName).C(extract_back).Find(&q).Sort("publishtime").Iter()
-
-
 	updateExtract := [][]map[string]interface{}{}
-	log.Println("线程数:", threadNum)
+	log.Println("线程数只能为1")
 	pool := make(chan bool, threadNum)
 	wg := &sync.WaitGroup{}
 	n, repeateN := 0, 0
@@ -751,7 +729,6 @@ func timedTaskOnce() {
 		if n%10000 == 0 {
 			log.Println("current:", n, tmp["_id"], "repeateN:", repeateN)
 		}
-
 		if util.IntAll(tmp["repeat"]) == 1 || util.IntAll(tmp["repeat"]) == -1 {
 			tmp = make(map[string]interface{})
 			continue