From 3de25d4fe120105cb67e15bd2e44be596a20332c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sat, 3 Sep 2022 22:23:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/http_access_log_dao.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/db/models/http_access_log_dao.go b/internal/db/models/http_access_log_dao.go index 37d8d714..29d00801 100644 --- a/internal/db/models/http_access_log_dao.go +++ b/internal/db/models/http_access_log_dao.go @@ -141,6 +141,10 @@ func (this *HTTPAccessLogDAO) CreateHTTPAccessLogs(tx *dbs.Tx, accessLogs []*pb. // DumpAccessLogsFromQueue 从队列导入访问日志 func (this *HTTPAccessLogDAO) DumpAccessLogsFromQueue(size int) (hasMore bool, err error) { + if size <= 0 { + size = 100 + } + var dao = randomHTTPAccessLogDAO() if dao == nil { dao = &HTTPAccessLogDAOWrapper{ @@ -162,10 +166,6 @@ func (this *HTTPAccessLogDAO) DumpAccessLogsFromQueue(size int) (hasMore bool, e _ = tx.Commit() }() - if size <= 0 { - size = 1_000_000 - } - // 复制变量,防止中途改变 var oldQueue = oldAccessLogQueue var newQueue = accessLogQueue @@ -791,6 +791,9 @@ func (this *HTTPAccessLogDAO) SetupQueue() { accessLogQueuePercent = config.Percent accessLogCountPerSecond = config.CountPerSecond + if accessLogCountPerSecond <= 0 { + accessLogCountPerSecond = 10_000 + } if config.MaxLength <= 0 { config.MaxLength = 100_000 }