From c7d900ace4cfd5d516a04488d29d0acb933855ce Mon Sep 17 00:00:00 2001 From: boyce Date: Tue, 3 Nov 2020 16:47:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=AE=9A=E6=97=B6=E5=99=A8?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E6=97=B6=E9=97=B4=E4=B8=BA=E4=B8=80=E4=B8=AA?= =?UTF-8?q?Tick=E5=8D=95=E4=BD=8D(10ms)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/timewheel/timewheel.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/timewheel/timewheel.go b/util/timewheel/timewheel.go index b2e9402..d30de7d 100644 --- a/util/timewheel/timewheel.go +++ b/util/timewheel/timewheel.go @@ -258,6 +258,10 @@ func (t *timeWheel) newTimer(ticks int64,additionData interface{},c chan *Timer) pTimer.bClose = false pTimer.C = c pTimer.AdditionData = additionData + + if ticks<=0 { + ticks = 1 + } pTimer.expireTicks = ticks+t.currentTicks return pTimer }