From 4485d3d5a9adf821d0646abb694e24388359fcde Mon Sep 17 00:00:00 2001 From: fumiama Date: Tue, 14 Dec 2021 13:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=20=E4=BC=98=E5=8C=96=20up?= =?UTF-8?q?dater=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin_setutime/setu_geter.go | 11 ++++++----- utils/file/updater.go | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugin_setutime/setu_geter.go b/plugin_setutime/setu_geter.go index 91770531..6d3c3d59 100644 --- a/plugin_setutime/setu_geter.go +++ b/plugin_setutime/setu_geter.go @@ -17,6 +17,7 @@ import ( "github.com/FloatTech/ZeroBot-Plugin/control" fileutil "github.com/FloatTech/ZeroBot-Plugin/utils/file" "github.com/FloatTech/ZeroBot-Plugin/utils/math" + "github.com/FloatTech/ZeroBot-Plugin/utils/process" "github.com/FloatTech/ZeroBot-Plugin/utils/rule" "github.com/FloatTech/ZeroBot-Plugin/utils/sql" ) @@ -33,10 +34,6 @@ type imgpool struct { Form int64 } -const ( - dburl = "https://codechina.csdn.net/u011570312/ZeroBot-Plugin/-/raw/master/data/SetuTime/SetuTime.db" -) - // NewPoolsCache 返回一个缓冲池对象 func newPools() *imgpool { cache := &imgpool{ @@ -65,11 +62,15 @@ func newPools() *imgpool { } var ( - pool = newPools() + pool *imgpool limit = rate.NewManager(time.Minute*1, 5) ) func init() { // 插件主体 + go func() { + process.SleepAbout1sTo2s() + pool = newPools() + }() engine := control.Register("setutime", &control.Options{ DisableOnDefault: false, Help: "涩图\n" + diff --git a/utils/file/updater.go b/utils/file/updater.go index 9af15c64..6685331a 100644 --- a/utils/file/updater.go +++ b/utils/file/updater.go @@ -30,9 +30,9 @@ func GetLazyData(path string, isReturnDataBytes, isDataMustEqual bool) ([]byte, var filemd5 *[16]byte var ms string - logrus.Infoln("[file]检查懒加载文件:", path) u := dataurl + path lzmu.Lock() + logrus.Infoln("[file]检查懒加载文件:", path) err := registry.ConnectIn(time.Second * 4) if err != nil { logrus.Errorln("[file]无法连接到md5验证服务器,请自行确保下载文件的正确性:", err)