1
0
Fork 0
mirror of synced 2024-10-03 19:53:33 +13:00

Fix init startup

This commit is contained in:
Matej Baco 2022-11-16 20:53:59 +01:00
parent 48f143547a
commit 5dd31bcdfb

View file

@ -179,25 +179,29 @@ $cli
do { do {
$attempts++; $attempts++;
// Prepare database connection try {
$dbAdapter = $pools // Prepare database connection
->get('console') $dbAdapter = $pools
->pop() ->get('console')
->getResource(); ->pop()
->getResource();
$dbForConsole = new Database($dbAdapter, $cache); $dbForConsole = new Database($dbAdapter, $cache);
$dbForConsole->setNamespace('console'); $dbForConsole->setNamespace('console');
// Ensure tables exist // Ensure tables exist
$collections = Config::getParam('collections', []); $collections = Config::getParam('collections', []);
$last = \array_key_last($collections); $last = \array_key_last($collections);
if (!($dbForConsole->exists($dbForConsole->getDefaultDatabase(), $last))) {
throw new Exception('Tables not ready yet.');
}
if ($dbForConsole->exists($dbForConsole->getDefaultDatabase(), $last)) {
$ready = true; $ready = true;
break; } catch (\Exception $err) {
Console::warning($err->getMessage());
sleep($sleep);
} }
sleep($sleep);
} while ($attempts < $maxAttempts); } while ($attempts < $maxAttempts);
if (!$ready) { if (!$ready) {