|
|
@ -155,8 +155,6 @@ func (s *NodeServiceServer) sendToIotaChannels(data []common_models.IotaData) (c |
|
|
|
log.Println("Timeout while trying to send iotaData.") |
|
|
|
return nil, false |
|
|
|
} |
|
|
|
|
|
|
|
return nil, false // 如果所有通道都满了,返回 nil 和 false
|
|
|
|
} |
|
|
|
|
|
|
|
// 将 IotaData 转换为 DeviceData, 转换后数据发送到 s.processChannels
|
|
|
@ -213,9 +211,7 @@ func (s *NodeServiceServer) HandleIotaChan(ch chan []common_models.IotaData, ind |
|
|
|
sendTime := time.Now() |
|
|
|
processChannel, ok := s.sendToProcessChannels(processDataArray, index) // 这里会一直等到有资源
|
|
|
|
if !ok { |
|
|
|
// TODO processChannels 满了之后做什么处理?
|
|
|
|
log.Printf("3.iotaDataArray[%v] s.processChannels %d个通道都已满,被阻塞。", formattedTime, len(s.processChannels)) |
|
|
|
|
|
|
|
} else { |
|
|
|
log.Printf("3.iotaDataArray[%v] 已发送至s.processChannels。processChannel[%p]数据量:%d/%d, \n发送耗时:%v ,iotaDataArray处理耗时:%v", |
|
|
|
formattedTime, processChannel, len(processChannel), cap(processChannel), time.Since(sendTime), time.Since(dataHandleTime)) |
|
|
|