From 59cb7706a050140c2f198514920ff9079f126e87 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 26 Apr 2019 11:56:57 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E9=9D=9E=E7=94=9F=E4=BA=A7=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E4=B8=8D=E9=99=90=E5=88=B6GetMsg=E7=9A=84=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/msghub/msghub.go | 10 ++++++---- globals/globals.go | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/business/msghub/msghub.go b/business/msghub/msghub.go index 7766a0d95..39144e0f3 100644 --- a/business/msghub/msghub.go +++ b/business/msghub/msghub.go @@ -125,10 +125,12 @@ func GetMsg(ctx *jxcontext.Context, storeID int, lastOrderTime time.Time, lastOr pollingDuration := defPollingDuration if waitingSecond != 0 { pollingDuration = time.Duration(waitingSecond) * time.Second - if pollingDuration > maxPollingDuration { - pollingDuration = maxPollingDuration - } else if pollingDuration < minPollingDuration { - pollingDuration = minPollingDuration + if globals.IsProductEnv() { + if pollingDuration > maxPollingDuration { + pollingDuration = maxPollingDuration + } else if pollingDuration < minPollingDuration { + pollingDuration = minPollingDuration + } } } timer := time.NewTimer(pollingDuration) diff --git a/globals/globals.go b/globals/globals.go index c6ab1223a..22a71c863 100644 --- a/globals/globals.go +++ b/globals/globals.go @@ -77,3 +77,7 @@ func Init() { func IsCallbackAlwaysReturnSuccess() bool { return beego.BConfig.RunMode == "beta" } + +func IsProductEnv() bool { + return beego.BConfig.RunMode == "prod" || beego.BConfig.RunMode == "jxgy" +}