Parcourir la source

sub: 过滤掉数据为null

Yi il y a 4 mois
Parent
commit
275060f510
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      module/mqtt/sub.go

+ 3 - 1
module/mqtt/sub.go

@@ -119,7 +119,9 @@ func (d *DataEventEntry) SubMsgLog(configOption *config.AppConfig) {
 		select {
 		case msg := <-subMsgChan:
 			subMsLog := d.CreatMsgLog(msg)
-			batchList = append(batchList, subMsLog)
+			if subMsLog != nil {
+				batchList = append(batchList, subMsLog)
+			}
 			if len(batchList) >= batchSize {
 				DSMLog.Mx.Lock()
 				DSMLog.SubMsgLogList = append(DSMLog.SubMsgLogList, batchList...)