nextcloud/lib
Louis Chemineau f9a4e80a72 fix: Initialize lastConnectionCheck after first connection
We are checking whether the DB connection is alive once every 30 seconds. But when we are lacking the last check time, we are skipping the check and reconnect logic. This is causing the reconnect logic to never fire in those cases.

It seems to me that "those cases", are actually always the case, as upon initialization, we are not using the proper connection name to store the time.

In the `connect()` logic, when `$this->_conn` is null, `$this->getConnectionName()` is returning `replica`, so `$this->lastConnectionCheck` will be equal to `['replica' => time()];`

60711ea4cf/lib/private/DB/Connection.php (L215-L221)

60711ea4cf/lib/private/DB/Connection.php (L891-L893)

2b6d7bf65f/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php (L136-L139)

Then, if the connection name ends up as being 'primary', the reconnect logic is skipped:

60711ea4cf/lib/private/DB/Connection.php (L874-L880)

Follow-up of https://github.com/nextcloud/server/pull/41819

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-02-25 11:08:43 +00:00
..
composer fix: replace null character when serializing 2024-12-13 22:00:46 -05:00
l10n Fix(l10n): Update translations from Transifex 2025-02-24 21:01:26 +00:00
private fix: Initialize lastConnectionCheck after first connection 2025-02-25 11:08:43 +00:00
public fix: Change UserAgent to *cloud 2025-02-21 09:28:41 +00:00
autoloader.php fix: Apply new coding standard to all files 2024-04-04 11:45:22 +02:00
base.php fix: Do not check for strict cookie when running webcron 2024-11-15 12:26:22 +00:00
versioncheck.php Allow PHP 8.3 in version check 2023-09-30 22:52:57 +02:00