allow to specify how many times we can try to connect to the database at startup

add config options:
db_startup_connection_max_attempts - default 0 (infinite)
db_startup_connection_attempt_delay - delay in seconds between attempts (default 5)

BREAKING CHANGE: WINIX_PLUGIN_INIT plugin message requires to set result status,
you have to set the result status to true (env.res) if your
plugin was initialized correctly, otherwise winix will not start
This commit is contained in:
2022-04-29 06:17:16 +02:00
parent c6c50a5d23
commit da2dec447b
18 changed files with 154 additions and 41 deletions

View File

@@ -57,7 +57,7 @@ public:
void SetConnParam(const std::wstring & host, const std::wstring & hostaddr, const std::wstring & port,
const std::wstring & database, const std::wstring & user, const std::wstring & pass);
void Connect();
void WaitForConnection();
bool WaitForConnection(size_t attempts_max, size_t attempt_delay);
void Close();
bool AssertConnection(bool put_log = true, bool throw_if_no_connection = true);
void SetDbParameters();
@@ -65,6 +65,7 @@ public:
private:
void LogNoConnection(size_t attempts);
void LogConnectionSocket();
PGconn * pg_conn;