8000 feature #44532 Handle CSV DSN in ZookeeperStore (qkdreyer) · symfony/symfony@9f28dbd · GitHub
[go: up one dir, main page]

Skip to content

Commit 9f28dbd

Browse files
committed
feature #44532 Handle CSV DSN in ZookeeperStore (qkdreyer)
This PR was squashed before being merged into the 6.1 branch. Discussion ---------- Handle CSV DSN in ZookeeperStore | Q | A | ------------- | --- | Branch? | 6.1 for features / 4.4, 5.3, 5.4 or 6.0 for bug fixes <!-- see below --> | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Commits ------- b2977c2 Handle CSV DSN in ZookeeperStore
2 parents 28ab68e + b2977c2 commit 9f28dbd

File tree

2 files changed

+8
-3
lines changed

src/Symfony/Component/Lock/Store/ZookeeperStore.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ public static function createConnection(string $dsn): \Zookeeper
4545
}
4646

4747
$host = $params['host'] ?? '';
48-
if (isset($params['port'])) {
49-
$host .= ':'.$params['port'];
48+
$hosts = explode(',', $host);
49+
50+
foreach ($hosts as $index => $host) {
51+
if (isset($params['port'])) {
52+
$hosts[$index] = $host.':'.$params['port'];
53+
}
5054
}
5155

52-
return new \Zookeeper($host);
56+
return new \Zookeeper(implode($hosts, ','));
5357
}
5458

5559
/**

src/Symfony/Component/Lock/Tests/Store/StoreFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function validConnections()
6363
if (class_exists(\Zookeeper::class)) {
6464
yield [$this->createMock(\Zookeeper::class), ZookeeperStore::class];
6565
yield ['zookeeper://localhost:2181', ZookeeperStore::class];
66+
yield ['zookeeper://localhost01,localhost02:2181', ZookeeperStore::class];
6667
}
6768
if (\extension_loaded('sysvsem')) {
6869
yield ['semaphore', SemaphoreStore::class];

0 commit comments

Comments
 (0)
0