fix the defer
This commit is contained in:
@@ -48,7 +48,8 @@ func Init(cfg *config.Config) {
|
|||||||
db.SetMaxIdleConns(5)
|
db.SetMaxIdleConns(5)
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel
|
defer cancel()
|
||||||
|
|
||||||
if err = db.PingContext(ctx); err != nil {
|
if err = db.PingContext(ctx); err != nil {
|
||||||
log.Fatalf("Failed to ping database: %v", err)
|
log.Fatalf("Failed to ping database: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user