This commit is contained in:
parent
aa140a9627
commit
d8279de232
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
@ -79,8 +78,6 @@ func (p *OrderRepoImpl) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderB
|
||||||
tx := db.Create(info)
|
tx := db.Create(info)
|
||||||
|
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
sqlDB, _ := db.DB()
|
|
||||||
log.Warnf("order create 当前打开连接数:%d,空闲连接数:%d", sqlDB.Stats().OpenConnections, sqlDB.Stats().Idle)
|
|
||||||
return nil, fmt.Errorf("create db fail %w", tx.Error)
|
return nil, fmt.Errorf("create db fail %w", tx.Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -100,11 +97,6 @@ func (p *OrderRepoImpl) GetByOutBizNo(ctx context.Context, t vo.OrderType, outBi
|
||||||
return nil, err2.ErrorDbNotFound("订单数据不存在")
|
return nil, err2.ErrorDbNotFound("订单数据不存在")
|
||||||
}
|
}
|
||||||
|
|
||||||
if errors.Is(tx.Error, context.DeadlineExceeded) {
|
|
||||||
sqlDB, _ := db.DB()
|
|
||||||
log.Warnf("order当前打开连接数:%d,空闲连接数:%d", sqlDB.Stats().OpenConnections, sqlDB.Stats().Idle)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil, fmt.Errorf("order db fail %w", tx.Error)
|
return nil, fmt.Errorf("order db fail %w", tx.Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue