Retry monitoring TG database connection on startup
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"time"
|
||||
|
||||
"monitoring-tg/internal/aiservice"
|
||||
"monitoring-tg/internal/dbretry"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
@@ -69,7 +70,7 @@ func main() {
|
||||
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
pool, err := pgxpool.New(ctx, cfg.databaseURL())
|
||||
pool, err := dbretry.Connect(ctx, cfg.databaseURL(), 2*time.Minute)
|
||||
if err != nil {
|
||||
slog.Error("db_connect_failed", "error", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user