1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Retry initial db connection once before throwing exception

This commit is contained in:
kodumbeats 2021-07-19 15:39:31 -04:00
parent 48ad89ac27
commit 8a205d1b63

View file

@ -72,7 +72,13 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) {
// wait for database to be ready
sleep(5);
$dbForConsole = $app->getResource('dbForConsole'); /** @var Utopia\Database\Database $dbForConsole */
try {
$dbForConsole = $app->getResource('dbForConsole'); /** @var Utopia\Database\Database $dbForConsole */
} catch(\Exception $e) {
Console::warning('Database not ready. Retrying connection...');
sleep(5);
$dbForConsole = $app->getResource('dbForConsole'); /** @var Utopia\Database\Database $dbForConsole */
}
if(!$dbForConsole->exists()) {
Console::success('[Setup] - Server database init started...');