fix(legacy): log errors on connect check failure (#2317)

This commit is contained in:
Jonas L 2022-12-16 19:07:38 +01:00
parent 5bdb2628b1
commit d9fe7d8712
2 changed files with 19 additions and 9 deletions

View File

@ -88,7 +88,9 @@ function checkDatabaseConfiguration()
// wrong, the database is improperly configured // wrong, the database is improperly configured
Propel::getConnection(); Propel::getConnection();
Propel::close(); Propel::close();
} catch (Exception $e) { } catch (Exception $exc) {
Logging::error($exc->getMessage());
return false; return false;
} }
@ -112,15 +114,21 @@ function checkRMQConnection()
{ {
$config = Config::getConfig(); $config = Config::getConfig();
$conn = new \PhpAmqpLib\Connection\AMQPStreamConnection( try {
$config['rabbitmq']['host'], $conn = new \PhpAmqpLib\Connection\AMQPStreamConnection(
$config['rabbitmq']['port'], $config['rabbitmq']['host'],
$config['rabbitmq']['user'], $config['rabbitmq']['port'],
$config['rabbitmq']['password'], $config['rabbitmq']['user'],
$config['rabbitmq']['vhost'] $config['rabbitmq']['password'],
); $config['rabbitmq']['vhost']
);
return isset($conn); return isset($conn);
} catch (\PhpAmqpLib\Exception\AMQPRuntimeException $exc) {
Logging::error($exc->getMessage());
return false;
}
} }
/** /**

View File

@ -5,3 +5,5 @@ require_once __DIR__ . '/configs/constants.php';
require_once VENDOR_PATH . '/autoload.php'; require_once VENDOR_PATH . '/autoload.php';
require_once CONFIG_PATH . '/conf.php'; require_once CONFIG_PATH . '/conf.php';
Logging::setLogPath(LIBRETIME_LOG_FILEPATH);