Переглянути джерело

新增删除方法,biddingall同时生备份库索引

maxiaoshan 5 роки тому
батько
коміт
a324910ca3
2 змінених файлів з 14 додано та 1 видалено
  1. 6 0
      udpcreateindex/src/biddingall.go
  2. 8 1
      udpcreateindex/src/main.go

+ 6 - 0
udpcreateindex/src/biddingall.go

@@ -290,6 +290,9 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 				if len(multiIndex) == 2 {
 					elastic.BulkSave(multiIndex[0], multiIndex[1], &tmps, true)
 				}
+				if other_index != "" && other_itype != "" { //备份库同时生索引
+					bidding_other_es.BulkSave(other_index, other_itype, &tmps, true)
+				}
 				arrEs = []map[string]interface{}{}
 			}
 			UpdatesLock.Unlock()
@@ -313,6 +316,9 @@ func biddingAllTask(data []byte, mapInfo map[string]interface{}) {
 		if len(multiIndex) == 2 {
 			elastic.BulkSave(multiIndex[0], multiIndex[1], &tmps, true)
 		}
+		if other_index != "" && other_itype != "" { //备份库同时生索引
+			bidding_other_es.BulkSave(other_index, other_itype, &tmps, true)
+		}
 	}
 	UpdatesLock.Unlock()
 	log.Println(mapInfo, "create bidding index...over", n)

+ 8 - 1
udpcreateindex/src/main.go

@@ -93,7 +93,6 @@ func init() {
 		DbName:      standard["db"].(string),
 	}
 	mgostandard.InitPool()
-	log.Println(standard["addr"].(string))
 	//初始化es
 	//bidding
 	econf := Sysconfig["elastic"].(map[string]interface{})
@@ -255,6 +254,14 @@ func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
 					}()
 					standardTask("agencyent", mapInfo)
 				}()
+			case "biddingdel": //标准库
+				pool <- true
+				go func() {
+					defer func() {
+						<-pool
+					}()
+					biddingDel(data, mapInfo)
+				}()
 			default:
 				pool <- true
 				go func() {