Commit d9150ce3 by mushishixian

添加时间间隔

parent ce726eaf
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"bom_server/internal/model" "bom_server/internal/model"
"math" "math"
"sync" "sync"
"time"
"github.com/prometheus/common/log" "github.com/prometheus/common/log"
es "gopkg.in/olivere/elastic.v5" es "gopkg.in/olivere/elastic.v5"
...@@ -52,6 +53,7 @@ func MatchGoods(message model.BomMessage) (err error) { ...@@ -52,6 +53,7 @@ func MatchGoods(message model.BomMessage) (err error) {
} else { } else {
bomData = bomItems[i : i+perGoDealNumber] bomData = bomItems[i : i+perGoDealNumber]
} }
time.Sleep(100 * time.Millisecond)
go func() { go func() {
if len(bomData) != 0 { if len(bomData) != 0 {
if err := SearchGoods(bomId, bomData, message.DeliveryType, message.Sort, &wg); err != nil { if err := SearchGoods(bomId, bomData, message.DeliveryType, message.Sort, &wg); err != nil {
......
...@@ -35,6 +35,8 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor ...@@ -35,6 +35,8 @@ func search(index string, bomId int, bomItems []model.BomItem, deliveryType, sor
//构建一个goods_name对应的bomItems列表 //构建一个goods_name对应的bomItems列表
searchRequest := getSearchParams(index, bom, sort, paramsRawSearch) searchRequest := getSearchParams(index, bom, sort, paramsRawSearch)
searchFlag = true searchFlag = true
//randInt := rand.Intn(10)
//time.Sleep(10 * time.Millisecond)
search.Add(searchRequest) search.Add(searchRequest)
} }
//没有搜索条件的话,直接返回空值即可 //没有搜索条件的话,直接返回空值即可
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment