From d09aee0b82da3a224af8e6780a515e1ccf264a3c Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Wed, 1 Sep 2021 17:56:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=20=E5=88=A0=E9=99=A4jwt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.yaml | 1 + server/initialize/timer.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/config.yaml b/server/config.yaml index 66a4cf9e..8130f1ed 100644 --- a/server/config.yaml +++ b/server/config.yaml @@ -130,6 +130,7 @@ Timer: # interval: 时间间隔, 具体配置详看 time.ParseDuration() 中字符串表示 且不能为负数 # 2160h = 24 * 30 * 3 -> 三个月 { tableName: "sys_operation_records" , compareField: "created_at", interval: "2160h" }, + { tableName: "jwt_blacklists" , compareField: "created_at", interval: "168h" } #{ tableName: "log2" , compareField: "created_at", interval: "2160h" } ] diff --git a/server/initialize/timer.go b/server/initialize/timer.go index f65180b2..62c8185b 100644 --- a/server/initialize/timer.go +++ b/server/initialize/timer.go @@ -10,7 +10,7 @@ import ( func Timer() { if global.GVA_CONFIG.Timer.Start { - for _, detail := range global.GVA_CONFIG.Timer.Detail { + for i := range global.GVA_CONFIG.Timer.Detail { go func(detail config.Detail) { global.GVA_Timer.AddTaskByFunc("ClearDB", global.GVA_CONFIG.Timer.Spec, func() { err := utils.ClearTable(global.GVA_DB, detail.TableName, detail.CompareField, detail.Interval) @@ -18,7 +18,7 @@ func Timer() { fmt.Println("timer error:", err) } }) - }(detail) + }(global.GVA_CONFIG.Timer.Detail[i]) } } }