1
0
Fork 0
mirror of synced 2024-07-04 14:10:33 +12: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 {
$attempts++;
// Prepare database connection
$dbAdapter = $pools
->get('console')
->pop()
->getResource();
try {
// Prepare database connection
$dbAdapter = $pools
->get('console')
->pop()
->getResource();
$dbForConsole = new Database($dbAdapter, $cache);
$dbForConsole->setNamespace('console');
$dbForConsole = new Database($dbAdapter, $cache);
$dbForConsole->setNamespace('console');
// Ensure tables exist
$collections = Config::getParam('collections', []);
$last = \array_key_last($collections);
// Ensure tables exist
$collections = Config::getParam('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;
break;
} catch (\Exception $err) {
Console::warning($err->getMessage());
sleep($sleep);
}
sleep($sleep);
} while ($attempts < $maxAttempts);
if (!$ready) {