forked from mtusi2026/mtusi2026lab3
refactor(app) agent refactoring + a little review
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/config"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/database"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/health"
|
||||
"gitflic.ru/project/bulla-max/mtusi2026lab/internal/session"
|
||||
)
|
||||
|
||||
@@ -32,10 +33,7 @@ func main() {
|
||||
defer pool.Close()
|
||||
|
||||
if cfg.MigrateOnly || cfg.RunMigrations {
|
||||
migrateCtx, cancelMigrate := context.WithTimeout(rootCtx, 60*time.Second)
|
||||
err = database.Migrate(migrateCtx, pool, cfg.DatabaseURL)
|
||||
cancelMigrate()
|
||||
if err != nil {
|
||||
if err = database.Migrate(cfg.DatabaseURL); err != nil {
|
||||
log.Fatalf("migrations: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -68,7 +66,7 @@ func main() {
|
||||
}
|
||||
|
||||
log.Printf("shutting down")
|
||||
internal.SignalGracefulShutdown()
|
||||
health.SignalShutdown()
|
||||
if err = app.ShutdownWithTimeout(10 * time.Second); err != nil {
|
||||
log.Printf("shutdown: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user