From bf228385629e5eb5d26185b14472b7d6691550bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Sat, 16 Nov 2024 15:07:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dsqlite=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=89=A7=E8=A1=8Ctruncate=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#372)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/isql/operation_log_isql.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/isql/operation_log_isql.go b/service/isql/operation_log_isql.go index 739b206..b5c6e42 100644 --- a/service/isql/operation_log_isql.go +++ b/service/isql/operation_log_isql.go @@ -21,7 +21,7 @@ type OperationLogService struct{} func (s OperationLogService) SaveOperationLogChannel(olc <-chan *model.OperationLog) { // 只会在线程开启的时候执行一次 Logs := make([]model.OperationLog, 0) - //5s 自动同步一次 + // 5s 自动同步一次 duration := 5 * time.Second timer := time.NewTimer(duration) defer timer.Stop() @@ -35,7 +35,7 @@ func (s OperationLogService) SaveOperationLogChannel(olc <-chan *model.Operation Logs = make([]model.OperationLog, 0) timer.Reset(duration) // 入库重置定时器 } - case <-timer.C: //5s 自动同步一次 + case <-timer.C: // 5s 自动同步一次 if len(Logs) > 0 { common.DB.Create(&Logs) Logs = make([]model.OperationLog, 0) @@ -102,5 +102,5 @@ func (s OperationLogService) Delete(operationLogIds []uint) error { // Clean 清空日志 func (s OperationLogService) Clean() error { - return common.DB.Exec("TRUNCATE TABLE operation_logs").Error + return common.DB.Exec("DELETE FROM operation_logs").Error }