Browse Source

update

master
dengbiao 4 months ago
parent
commit
777f072274
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      rule/one_circles/svc/svc_now_price_redis_mutex_lock.go

+ 2
- 2
rule/one_circles/svc/svc_now_price_redis_mutex_lock.go View File

@@ -28,7 +28,7 @@ func TryGetDistributedLock(lockKey, requestId string, isNegative bool) bool {
if retry > 99 { if retry > 99 {
return false return false
} }
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000)))
time.Sleep(time.Millisecond * time.Duration(rand.Intn(100)))
retry += 1 retry += 1
} }
} else { // 只尝试一次 } else { // 只尝试一次
@@ -73,7 +73,7 @@ func HandleDistributedLock(masterId, requestIdPrefix string) (cb func(), err err
requestId := GetDistributedLockRequestId(requestIdPrefix) requestId := GetDistributedLockRequestId(requestIdPrefix)
balanceLockOk := TryGetDistributedLock(balanceLockKey, requestId, true) balanceLockOk := TryGetDistributedLock(balanceLockKey, requestId, true)
if !balanceLockOk { if !balanceLockOk {
return nil, errors.New("系统繁忙,请稍后再试")
return nil, errors.New("获取价格系统繁忙,请稍后再试")
} }


cb = func() { cb = func() {


Loading…
Cancel
Save