Skip to content

Commit a2ad442

Browse files
committed
MAGETWO-98151: Add support ZooKeeper and flock locks
1 parent b5eaa81 commit a2ad442

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/internal/Magento/Framework/Lock/Backend/File.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __construct(FileDriver $fileDriver, string $path)
5959
}
6060

6161
$this->fileDriver = $fileDriver;
62-
$this->path = preg_replace('#\/*$#', '', $path) ?: '/';
62+
$this->path = rtrim($path, '/') . '/';
6363

6464
try {
6565
if (!$this->fileDriver->isExists($this->path)) {
@@ -159,7 +159,7 @@ public function unlock(string $name): bool
159159
*/
160160
private function getLockPath(string $name): string
161161
{
162-
return $this->path . '/' . $name;
162+
return $this->path . $name;
163163
}
164164

165165
/**

lib/internal/Magento/Framework/Lock/Backend/Zookeeper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function __construct(string $host, string $path = self::DEFAULT_PATH)
9797
}
9898

9999
$this->host = $host;
100-
$this->path = preg_replace('#\/*$#', '', $path) ?: '/';
100+
$this->path = rtrim($path, '/') . '/';
101101
}
102102

103103
/**
@@ -171,7 +171,7 @@ public function isLocked(string $name): bool
171171
*/
172172
private function getFullPathToLock(string $name): string
173173
{
174-
return $this->path . '/' . $name . '/' . $this->lockName;
174+
return $this->path . $name . '/' . $this->lockName;
175175
}
176176

177177
/**

0 commit comments

Comments
 (0)