lock failed
This commit is contained in:
parent
cff1310b2e
commit
e92f4f4fff
|
|
@ -75,7 +75,7 @@ func (p *OrderRepoImpl) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderB
|
||||||
|
|
||||||
tx := p.db.DB(ctx).Create(info)
|
tx := p.db.DB(ctx).Create(info)
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
return nil, tx.Error
|
return nil, fmt.Errorf("db fail %w", tx.Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
return p.ToBo(info), nil
|
return p.ToBo(info), nil
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ func (c *Mutex) Lock(ctx context.Context, resource string, callback func(ctx con
|
||||||
l := c.locker.GetLock(resource)
|
l := c.locker.GetLock(resource)
|
||||||
|
|
||||||
if err := l.Lock(ctx); err != nil {
|
if err := l.Lock(ctx); err != nil {
|
||||||
return fmt.Errorf("lock failed: %w", err)
|
return fmt.Errorf("lock failed %s:%w", resource, err)
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
_ = l.Unlock(ctx)
|
_ = l.Unlock(ctx)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue