nextcloud/lib
Louis Chemineau 066c92f7b0 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-19 12:25:12 +01:00
..
composer chore(filecache): remove index fs_id_storage_size 2025-02-13 11:37:10 +01:00
l10n Fix(l10n): Update translations from Transifex 2025-02-19 00:21:45 +00:00
private fix: Initialize lastConnectionCheck after first connection 2025-02-19 12:25:12 +01:00
public chore: Correctly flag json encoding methods as escaping html and quotes 2025-02-17 15:24:07 +01:00
unstable fix(lexicon): syntax 2025-01-14 10:38:15 -01:00
autoloader.php chore: Add SPDX header 2024-05-24 13:11:22 +02:00
base.php Merge pull request #48738 from nextcloud/perf/log-high-memory-requests 2025-02-13 19:50:32 +01:00
versioncheck.php feat(PHP): Allow PHP 8.4 2024-11-08 12:59:12 +01:00