fix: mqtt data identify.
This commit is contained in:
@@ -245,8 +245,15 @@ func (s *DebugService) maybePersist(record interface{}) {
|
||||
if !enabled {
|
||||
return
|
||||
}
|
||||
if err := s.db.Clauses(clause.OnConflict{DoNothing: true}).Create(record).Error; err != nil {
|
||||
log.Printf("mqtt debug persist failed type=%T err=%v", record, err)
|
||||
tx := s.db.Clauses(clause.OnConflict{DoNothing: true}).Create(record)
|
||||
if tx.Error != nil {
|
||||
log.Printf("mqtt debug persist failed type=%T err=%v", record, tx.Error)
|
||||
return
|
||||
}
|
||||
if tx.RowsAffected > 0 {
|
||||
//logPersistResult("mqtt debug", "inserted", record)
|
||||
} else {
|
||||
//logPersistResult("mqtt debug", "skipped duplicate", record)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user