From 81d5cf5ebe5c1baa249e241ffae42ddfa8c2ade8 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 6 Sep 2023 18:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=B8=A6=E5=AE=BD=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=A2=9E=E5=8A=A0=E6=9C=80=E5=B0=8F=E6=A0=B7=E6=9C=AC?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/server_bandwidth_stat_dao.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/db/models/server_bandwidth_stat_dao.go b/internal/db/models/server_bandwidth_stat_dao.go index d3208a73..be2fbd26 100644 --- a/internal/db/models/server_bandwidth_stat_dao.go +++ b/internal/db/models/server_bandwidth_stat_dao.go @@ -380,7 +380,7 @@ func (this *ServerBandwidthStatDAO) FindAllServerStatsWithMonth(tx *dbs.Tx, serv } // FindMonthlyPercentile 获取某月内百分位 -func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId int64, month string, percentile int, useAvg bool, noPlan bool) (result int64, err error) { +func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId int64, month string, percentile int, useAvg bool, noPlan bool, minSamples int) (result int64, err error) { if percentile <= 0 { percentile = 95 } @@ -415,7 +415,7 @@ func (this *ServerBandwidthStatDAO) FindMonthlyPercentile(tx *dbs.Tx, serverId i if err != nil { return 0, err } - if total == 0 { + if total == 0 || total < int64(minSamples) { return 0, nil }