Merge pull request #51017 from nextcloud/backport/50874/stable31

[stable31] fix: Initialize lastConnectionCheck after first connection
This commit is contained in:
Côme Chilliet 2025-02-25 16:01:39 +01:00 committed by GitHub
commit 5b421c99c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -218,8 +218,6 @@ class Connection extends PrimaryReadReplicaConnection {
return parent::connect();
}
$this->lastConnectionCheck[$this->getConnectionName()] = time();
// Only trigger the event logger for the initial connect call
$eventLogger = Server::get(IEventLogger::class);
$eventLogger->start('connect:db', 'db connection opened');
@ -227,6 +225,8 @@ class Connection extends PrimaryReadReplicaConnection {
$status = parent::connect();
$eventLogger->end('connect:db');
$this->lastConnectionCheck[$this->getConnectionName()] = time();
return $status;
} catch (Exception $e) {
// throw a new exception to prevent leaking info from the stacktrace