Skip to content

Commit

Permalink
Cast int to duration
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswinsimon committed Mar 25, 2024
1 parent 816c403 commit 4238c9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/database/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ func InitDB(config *Config) (*gorm.DB, error) {
}

if (config.MaxLifetime != 0) {
sqlDB.SetConnMaxLifetime(time.Second * config.MaxLifetime)
sqlDB.SetConnMaxLifetime(time.Second * time.Duration(config.MaxLifetime))
} else {
sqlDB.SetConnMaxLifetime(time.Minute * 10)
}

if (config.MaxIdleTime != 0) {
sqlDB.SetConnMaxIdleTime(time.Second * config.MaxIdleTime)
sqlDB.SetConnMaxIdleTime(time.Second * time.Duration(config.MaxIdleTime))
} else {
sqlDB.SetConnMaxIdleTime(time.Minute * 5)
}
Expand Down

0 comments on commit 4238c9a

Please sign in to comment.