Skip to content

Commit d1752d3

Browse files
committed
MAGETWO-98151: Add support ZooKeeper locks
1 parent ba4f6ba commit d1752d3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/internal/Magento/Framework/Lock/LockBackendFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ public function create(): LockManagerInterface
8484
throw new RuntimeException(new Phrase('Unknown locks provider.'));
8585
}
8686

87+
if (self::LOCK_ZOOKEEPER === $provider && !extension_loaded(self::LOCK_ZOOKEEPER)) {
88+
throw new RuntimeException(new Phrase('php extension Zookeeper is not installed.'));
89+
}
90+
8791
return $this->objectManager->create($this->lockers[$provider], $config);
8892
}
8993
}

lib/internal/Magento/Framework/Lock/Test/Unit/Backend/ZookeeperTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ class ZookeeperTest extends TestCase
3838
*/
3939
protected function setUp()
4040
{
41+
if (!extension_loaded('zookeeper')) {
42+
$this->markTestSkipped('Test was skipped because php extension Zookeeper is not installed.');
43+
}
4144
$this->zookeeperProvider = new ZookeeperProvider($this->host, '/some/path/');
4245
}
4346

@@ -49,6 +52,4 @@ public function testConstructionWithException()
4952
{
5053
$this->zookeeperProvider = new ZookeeperProvider('some host', '');
5154
}
52-
53-
5455
}

0 commit comments

Comments
 (0)