日志切片为空逻辑优化 (#69)

This commit is contained in:
Evan 2022-07-12 16:15:03 +08:00 committed by GitHub
parent 697c71cf91
commit 3c15977fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -36,10 +36,11 @@ func (s OperationLogService) SaveOperationLogChannel(olc <-chan *model.Operation
timer.Reset(duration) // 入库重置定时器
}
case <-timer.C: //5s 自动同步一次
if len(Logs) > 0 {
common.DB.Create(&Logs)
Logs = make([]model.OperationLog, 0)
}
timer.Reset(duration) // 入库重置定时器
}
}
}