1
0
mirror of https://github.com/golang/go synced 2024-09-30 15:18:32 -06:00

database/sql: use the built-in min function

This commit is contained in:
mstmdev 2023-09-25 16:35:27 +08:00
parent 451e4727ec
commit dc82635562

View File

@ -964,12 +964,7 @@ func (db *DB) shortestIdleTimeLocked() time.Duration {
if db.maxLifetime <= 0 {
return db.maxIdleTime
}
min := db.maxIdleTime
if min > db.maxLifetime {
min = db.maxLifetime
}
return min
return min(db.maxIdleTime, db.maxLifetime)
}
// SetMaxIdleConns sets the maximum number of connections in the idle