- 非生产环境不限制GetMsg的等待时间

This commit is contained in:
gazebo
2019-04-26 11:56:57 +08:00
parent b01968e451
commit 59cb7706a0
2 changed files with 10 additions and 4 deletions

View File

@@ -125,12 +125,14 @@ func GetMsg(ctx *jxcontext.Context, storeID int, lastOrderTime time.Time, lastOr
pollingDuration := defPollingDuration pollingDuration := defPollingDuration
if waitingSecond != 0 { if waitingSecond != 0 {
pollingDuration = time.Duration(waitingSecond) * time.Second pollingDuration = time.Duration(waitingSecond) * time.Second
if globals.IsProductEnv() {
if pollingDuration > maxPollingDuration { if pollingDuration > maxPollingDuration {
pollingDuration = maxPollingDuration pollingDuration = maxPollingDuration
} else if pollingDuration < minPollingDuration { } else if pollingDuration < minPollingDuration {
pollingDuration = minPollingDuration pollingDuration = minPollingDuration
} }
} }
}
timer := time.NewTimer(pollingDuration) timer := time.NewTimer(pollingDuration)
select { select {
case msg2, ok := <-chan2Listen: case msg2, ok := <-chan2Listen:

View File

@@ -77,3 +77,7 @@ func Init() {
func IsCallbackAlwaysReturnSuccess() bool { func IsCallbackAlwaysReturnSuccess() bool {
return beego.BConfig.RunMode == "beta" return beego.BConfig.RunMode == "beta"
} }
func IsProductEnv() bool {
return beego.BConfig.RunMode == "prod" || beego.BConfig.RunMode == "jxgy"
}