1
0
mirror of https://github.com/ManyakRus/starter.git synced 2025-11-24 22:53:52 +02:00

сделал Start_ctx()

This commit is contained in:
Nikitin Aleksandr
2024-09-27 16:32:56 +03:00
parent 4a2270cca1
commit 5de43d6e9b
20 changed files with 239 additions and 129 deletions

View File

@@ -57,6 +57,12 @@ func Connect(Connection connections.Connection) {
port_checker.CheckPort(Connection.Server, Connection.Port)
err := Connect_err(Connection)
LogInfo_Connected(err, Connection)
}
// LogInfo_Connected - выводит сообщение в Лог, или паника при ошибке
func LogInfo_Connected(err error, Connection connections.Connection) {
if err != nil {
log.Panicln("POSTGRES gorm stack Connect() to database host: ", Connection.Server, ", Error: ", err)
} else {
@@ -271,13 +277,12 @@ func WaitStop() {
// StartDB - делает соединение с БД, отключение и др.
func StartDB(Connection connections.Connection) {
Connect(Connection)
var err error
stopapp.GetWaitGroup_Main().Add(1)
go WaitStop()
stopapp.GetWaitGroup_Main().Add(1)
go ping_go()
ctx := contextmain.GetContext()
WaitGroup := stopapp.GetWaitGroup_Main()
err = Start_ctx(&ctx, WaitGroup, Connection)
LogInfo_Connected(err, Connection)
}