refactor: 将分布式锁从 redis 迁移至 utils 包
This commit is contained in:
@@ -17,7 +17,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"gitea.com/red-future/common/redis"
|
||||
"gitea.com/red-future/common/utils"
|
||||
gmq "github.com/bjang03/gmq/core/gmq"
|
||||
"github.com/bjang03/gmq/mq"
|
||||
@@ -188,7 +187,7 @@ func (s *stockManage) AddStock(ctx context.Context, msg any) error {
|
||||
ctx = context.WithValue(ctx, "tenantId", req.TenantId)
|
||||
// 获取redis-租户存储-锁key
|
||||
fileLockKey := fmt.Sprintf(public.StockDetailLockKey, req.AssetSkuId)
|
||||
success, err := redis.Lock(ctx, fileLockKey, int64(60), func(ctx context.Context) error {
|
||||
success, err := utils.Lock(ctx, fileLockKey, int64(60), func(ctx context.Context) error {
|
||||
if req.OperationType == "add" {
|
||||
if req.StockMode == stock.StockModeBatch {
|
||||
if !g.IsEmpty(req.StockId) {
|
||||
|
||||
Reference in New Issue
Block a user