fix bug
This commit is contained in:
@@ -2,6 +2,7 @@ package strategy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"git.apinb.com/quant/gostock/internal/impl"
|
"git.apinb.com/quant/gostock/internal/impl"
|
||||||
"git.apinb.com/quant/gostock/internal/models"
|
"git.apinb.com/quant/gostock/internal/models"
|
||||||
@@ -17,12 +18,19 @@ func BootAiStart(key string, ymd int) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
for _, row := range datas {
|
for _, row := range datas {
|
||||||
go BootAiTask(row.ID, row.Code)
|
wg.Add(1)
|
||||||
|
go BootAiTask(row.ID, row.Code, &wg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func BootAiTask(id uint, code string) {
|
func BootAiTask(id uint, code string, wg *sync.WaitGroup) {
|
||||||
|
defer wg.Done()
|
||||||
result, err := AiAnalysis(code)
|
result, err := AiAnalysis(code)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("ERROR BootAiTask", err.Error())
|
log.Println("ERROR BootAiTask", err.Error())
|
||||||
|
|||||||
Reference in New Issue
Block a user