mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Port away from removed IDBConnection->isConnected method
Instead track if the reconnection was successful with return value of connect method Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
parent
386ef04e42
commit
a40ca520d4
1 changed files with 4 additions and 6 deletions
|
|
@ -308,19 +308,17 @@ class Notify extends Base {
|
|||
->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OCP\IDBConnection
|
||||
*/
|
||||
private function reconnectToDatabase(IDBConnection $connection, OutputInterface $output) {
|
||||
private function reconnectToDatabase(IDBConnection $connection, OutputInterface $output): IDBConnection {
|
||||
try {
|
||||
$connection->close();
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while disconnecting from DB', 'level' => ILogger::WARN]);
|
||||
$output->writeln("<info>Error while disconnecting from database: {$ex->getMessage()}</info>");
|
||||
}
|
||||
while (!$connection->isConnected()) {
|
||||
$connected = false;
|
||||
while (!$connected) {
|
||||
try {
|
||||
$connection->connect();
|
||||
$connected = $connection->connect();
|
||||
} catch (\Exception $ex) {
|
||||
$this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while re-connecting to database', 'level' => ILogger::WARN]);
|
||||
$output->writeln("<info>Error while re-connecting to database: {$ex->getMessage()}</info>");
|
||||
|
|
|
|||
Loading…
Reference in a new issue