加锁调整

This commit is contained in:
ziming 2025-03-31 11:36:12 +08:00
parent ba25cc46ac
commit 48b5d897d6
2 changed files with 6 additions and 6 deletions

View File

@ -35,10 +35,10 @@ func (v *VoucherBiz) NotifyRetryConsume(ctx context.Context, orderNotifyId uint6
var ( var (
err error err error
orderNotify *bo.OrderNotifyBo orderNotify *bo.OrderNotifyBo
cache = vo.NotifyRetryConsume.BuildCacheUint64([]uint64{orderNotifyId}) c = vo.NotifyRetryConsume.BuildCacheUint64([]uint64{orderNotifyId})
) )
err = lock.NewMutex(v.rdb.Rdb, cache.TTL).Lock(ctx, cache.Key, func(ctx context.Context) error { err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error {
orderNotify, err = v.OrderNotifyRepo.GetByID(ctx, orderNotifyId) orderNotify, err = v.OrderNotifyRepo.GetByID(ctx, orderNotifyId)
if err != nil { if err != nil {

View File

@ -58,10 +58,10 @@ func (s CacheKey) GetValue() string {
func (s CacheKey) BuildCache(strArr []string) *Cache { func (s CacheKey) BuildCache(strArr []string) *Cache {
k := "" k := s.GetValue()
if len(strArr) > 0 { if len(strArr) > 0 {
k = helper.BuildStr(s.GetValue(), strArr) k = helper.BuildStr(k, strArr)
} }
c := &Cache{ c := &Cache{
@ -80,10 +80,10 @@ func (s CacheKey) BuildCache(strArr []string) *Cache {
func (s CacheKey) BuildCacheUint64(ids []uint64) *Cache { func (s CacheKey) BuildCacheUint64(ids []uint64) *Cache {
k := "" k := s.GetValue()
if len(ids) > 0 { if len(ids) > 0 {
k = helper.BuildStr(s.GetValue(), ids) k = helper.BuildStr(k, ids)
} }
c := &Cache{ c := &Cache{