| | |
| | | ticker := time.NewTicker(time.Second * 2) |
| | | go func(ticker *time.Ticker, s *FaceSdkService) { |
| | | defer ticker.Stop() |
| | | Exit: |
| | | defer wg.Done() |
| | | |
| | | for { |
| | | select { |
| | | case <-ticker.C: |
| | | fmt.Println("倒计时结束") |
| | | wg.Done() |
| | | break Exit |
| | | fmt.Println("timeout!") |
| | | return |
| | | default: |
| | | if feas,ok := resultMap[s.Id];ok { |
| | | fmt.Println("faceFea got!!!") |
| | | s.Result = feas |
| | | wg.Done() |
| | | break Exit |
| | | } else { |
| | | //fmt.Println("尚未拿到fea") |
| | | return |
| | | } |
| | | } |
| | | } |
| | | }(ticker, s) |
| | | fmt.Println("wa.Wait") |
| | | wg.Wait() |
| | | fmt.Println("<-ch") |
| | | } |
| | | |
| | | func readTestImgFile() protomsg.Image{ |