瀏覽代碼

oss附件定时生索引

maxiaoshan 5 年之前
父節點
當前提交
011fb9873e
共有 3 個文件被更改,包括 6 次插入7 次删除
  1. 1 1
      udpcreateindex/src/bidingpurchasing.go
  2. 2 3
      udpcreateindex/src/main.go
  3. 3 3
      udpcreateindex/src/task.go

+ 1 - 1
udpcreateindex/src/bidingpurchasing.go

@@ -36,7 +36,7 @@ func biddingPurchaingTask(q map[string]interface{}) {
 	i := 0
 	for tmp := make(map[string]interface{}); query.Next(tmp); i = i + 1 {
 		n++
-		if util.IntAll(tmp["extracttype"]) == -1 {
+		if util.IntAll(tmp["extracttype"]) == -1 { //重复数据不生索引
 			continue
 		}
 		newTmp := map[string]interface{}{} //最终生索引的数据

+ 2 - 3
udpcreateindex/src/main.go

@@ -33,8 +33,8 @@ var (
 
 func init() {
 	util.ReadConfig(&Sysconfig)
-	//inits()
-	//go checkMapJob()
+	inits()
+	go checkMapJob()
 	updport, _ = Sysconfig["updport"].(string)
 	winner, _ = Sysconfig["winner"].(map[string]interface{})
 	standard, _ = Sysconfig["standard"].(map[string]interface{})
@@ -102,7 +102,6 @@ func init() {
 }
 
 func main() {
-	//go task_projects()
 	//go task_biddingfile()
 	go task_index()
 	updport := Sysconfig["udpport"].(string)

+ 3 - 3
udpcreateindex/src/task.go

@@ -11,8 +11,8 @@ import (
 
 func task_index() {
 	c := cron.New()
-	//c.AddFunc("20 30 5 * * *", func() { task_projects() })
-	c.AddFunc("0 */1 * * * *", func() { task_biddingfile() })
+	c.AddFunc("20 30 5 * * *", func() { task_projects() })
+	c.AddFunc("0 0 */2 * * *", func() { task_biddingfile() }) //每两小时执行一次
 	c.Start()
 }
 
@@ -21,7 +21,7 @@ func task_biddingfile() {
 	defer qutil.Catch()
 	q := map[string]interface{}{
 		"extract_state": map[string]interface{}{
-			"$eq": 3,
+			"$eq": 2,
 		},
 	}
 	biddingPurchaingTask(q)