fix(DB): set sharding parameters only when intended

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2024-08-29 19:12:44 +02:00
parent e44f24f7ab
commit 381e922085
No known key found for this signature in database
GPG key ID: 7424F1874854DF23

View file

@ -225,11 +225,16 @@ class ConnectionFactory {
}
$connectionParams['sharding'] = $this->config->getValue('dbsharding', []);
$connectionParams['shard_connection_manager'] = $this->shardConnectionManager;
$connectionParams['auto_increment_handler'] = new AutoIncrementHandler(
$this->cacheFactory,
$this->shardConnectionManager,
);
if (!empty($connectionParams['sharding'])) {
$connectionParams['shard_connection_manager'] = $this->shardConnectionManager;
$connectionParams['auto_increment_handler'] = new AutoIncrementHandler(
$this->cacheFactory,
$this->shardConnectionManager,
);
} else {
// just in case only the presence could lead to funny behaviour
unset($connectionParams['sharding']);
}
$connectionParams = array_merge($connectionParams, $additionalConnectionParams);