Skip to content

Commit

Permalink
improve checking
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjunmo committed Aug 28, 2023
1 parent c793c4c commit e7b465e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sharding.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,8 @@ func (s *Sharding) switchConn(db *gorm.DB) {
if _, ok := db.Get(ShardingIgnoreStoreKey); !ok {
s.mutex.Lock()
if db.Statement.ConnPool != nil {
if _, ok = db.Statement.ConnPool.(ConnPool); !ok {
s.ConnPool = &ConnPool{ConnPool: db.Statement.ConnPool, sharding: s}
db.Statement.ConnPool = s.ConnPool
}
s.ConnPool = &ConnPool{ConnPool: db.Statement.ConnPool, sharding: s}
db.Statement.ConnPool = s.ConnPool
}
s.mutex.Unlock()
}
Expand Down

0 comments on commit e7b465e

Please sign in to comment.