|
@@ -163,7 +163,28 @@ func (c *Customer) GetData(stype string, dataSource int) {
|
|
|
if esversion == "v1" {
|
|
|
} else {
|
|
|
esCon := esv.VarEs.(*esv.EsV7)
|
|
|
- c.EsConGetDataV7(stype, dataSource, esCon)
|
|
|
+ for {
|
|
|
+ listLen := redis.GetInt("session", "es_status")
|
|
|
+ if listLen == 0 {
|
|
|
+ log.Println("es空闲!")
|
|
|
+ break
|
|
|
+ } else if listLen == 1 || listLen == 2 {
|
|
|
+ log.Println("es繁忙,", listLen)
|
|
|
+ }
|
|
|
+ time.Sleep(5 * time.Second)
|
|
|
+ }
|
|
|
+ for {
|
|
|
+ listLens := int(redis.LLEN("datag", "jyqyfw_es_query"))
|
|
|
+ if listLens < 2 {
|
|
|
+ redis.RPUSH("datag", "jyqyfw_es_query", 1)
|
|
|
+ c.EsConGetDataV7(stype, dataSource, esCon)
|
|
|
+ redis.LPOP("datag", "jyqyfw_es_query")
|
|
|
+ break
|
|
|
+ } else {
|
|
|
+ log.Println("企业级服务es进程数过多,", listLens)
|
|
|
+ }
|
|
|
+ time.Sleep(5 * time.Second)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -173,16 +194,6 @@ func (c *Customer) EsConGetDataV7(stype string, dataSource int, esCon *esv.EsV7)
|
|
|
ctx, _ := context.WithTimeout(context.Background(), 3*time.Hour)
|
|
|
for _, dm := range c.Departments {
|
|
|
for _, sr := range dm.Rules {
|
|
|
- for {
|
|
|
- listLen := redis.GetInt("session", "es_status")
|
|
|
- if listLen == 0 {
|
|
|
- log.Println("es空闲!")
|
|
|
- break
|
|
|
- } else if listLen == 1 || listLen == 2 {
|
|
|
- log.Println("系统繁忙,请稍后再试 ", listLen)
|
|
|
- }
|
|
|
- time.Sleep(5 * time.Second)
|
|
|
- }
|
|
|
ch := make(chan bool, 10)
|
|
|
wg := &sync.WaitGroup{}
|
|
|
esIndex := Index
|