From c09847ec074533e8dddf4c4e62ec370ec62c5a8a Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期六, 29 六月 2019 10:08:26 +0800 Subject: [PATCH] fix --- service/FaceSdkService.go | 25 ++++++++++--------------- 1 files changed, 10 insertions(+), 15 deletions(-) diff --git a/service/FaceSdkService.go b/service/FaceSdkService.go index 4749496..fcdcd04 100644 --- a/service/FaceSdkService.go +++ b/service/FaceSdkService.go @@ -81,7 +81,7 @@ } height := int32(picMat.Rows()) width := int32(picMat.Cols()) - //data := picMat.ToBytes() + data := picMat.ToBytes() timeUnix := time.Now().Unix() formatTimeStr := time.Unix(timeUnix, 0).Format("2006-01-02 15:04:05") @@ -89,7 +89,7 @@ Width: width, Height: height, Timestamp: formatTimeStr, - Data: imgB, + Data: data, Id: timeUnix, Cid:s.Id, },nil @@ -119,29 +119,24 @@ func (s *FaceSdkService) GetFaceFea(){ var wg sync.WaitGroup wg.Add(1) + ticker := time.NewTicker(time.Second * 3) + go func(ticker *time.Ticker, s *FaceSdkService) { + defer ticker.Stop() + defer wg.Done() - go func() { - Exit: for { select { - case <-time.Tick(time.Second*2): - fmt.Println("鍊掕鏃剁粨鏉�") - wg.Done() - break Exit + case <-ticker.C: + return default: if feas,ok := resultMap[s.Id];ok { - fmt.Println("faceFea got!!!") s.Result = feas - break Exit - } else { - fmt.Println("灏氭湭鎷垮埌fea") + return } } } - }() - fmt.Println("wa.Wait") + }(ticker, s) wg.Wait() - fmt.Println("<-ch") } func readTestImgFile() protomsg.Image{ -- Gitblit v1.8.0