diff --git a/postgres_gorm/postgres_gorm.go b/postgres_gorm/postgres_gorm.go index e7ae7c9e..3d45c0d7 100644 --- a/postgres_gorm/postgres_gorm.go +++ b/postgres_gorm/postgres_gorm.go @@ -109,6 +109,11 @@ func Connect_WithApplicationName_err(ApplicationName string) error { FillSettings() } + // + if contextmain.GetContext().Err() != nil { + return contextmain.GetContext().Err() + } + //get the database connection URL. dsn := GetDSN(ApplicationName) diff --git a/postgres_pgx/postgres_pgx.go b/postgres_pgx/postgres_pgx.go index 7b054abf..57a71dc2 100644 --- a/postgres_pgx/postgres_pgx.go +++ b/postgres_pgx/postgres_pgx.go @@ -93,7 +93,12 @@ func Connect_WithApplicationName_err(ApplicationName string) error { FillSettings() } - //ctxMain := context.Background() + // + if contextmain.GetContext().Err() != nil { + return contextmain.GetContext().Err() + } + + // ctxMain := contextmain.GetContext() ctx, cancel := context.WithTimeout(ctxMain, 60*time.Second) defer cancel()