🐛 Fix clear function doesn't real clear items in slice

This commit is contained in:
LittleSheep 2024-07-04 23:08:22 +08:00
parent 46468fae5f
commit 13c26486b6

View File

@ -37,12 +37,12 @@ func SaveEventChanges() {
count := len(writeEventQueue)
database.C.CreateInBatches(writeEventQueue, min(count, 1000))
log.Info().Int("count", count).Msg("Saved action events changes into database...")
clear(writeEventQueue)
writeEventQueue = nil
}
if len(writeAuditQueue) > 0 {
count := len(writeAuditQueue)
database.C.CreateInBatches(writeAuditQueue, min(count, 1000))
log.Info().Int("count", count).Msg("Saved audit records changes into database...")
clear(writeAuditQueue)
writeAuditQueue = nil
}
}