Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Aubry <mattab@users.noreply.github.com>2020-01-16 07:46:53 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2020-01-16 07:46:53 +0300
commitf284ec7ba88cc0c2ad8ea043e7f04759319da8f6 (patch)
tree19b278a53e124301a792a461a2552ce6d7dea592 /core/Concurrency
parente179798498f92f3462f21d9188516354c8ccc34b (diff)
Fix Could not get the lock for ID, when creating a site (#15401)
* Lock key start * do not empty key lock Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'core/Concurrency')
-rw-r--r--core/Concurrency/Lock.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/Concurrency/Lock.php b/core/Concurrency/Lock.php
index f63bec640a..e16b3465ce 100644
--- a/core/Concurrency/Lock.php
+++ b/core/Concurrency/Lock.php
@@ -50,11 +50,15 @@ class Lock
public function execute($id, $callback)
{
- if (Common::mb_strlen($id) > self::MAX_KEY_LEN) {
+ $maxLen = self::MAX_KEY_LEN;
+ if (!empty($this->lockKeyStart)) {
+ $maxLen = $maxLen - strlen($this->lockKeyStart);
+ }
+ if (Common::mb_strlen($id) > $maxLen) {
// Lock key might be too long for DB column, so we hash it but leave the start of the original as well
// to make it more readable
$md5Len = 32;
- $id = Common::mb_substr($id, 0, self::MAX_KEY_LEN - $md5Len - 1) . md5($id);
+ $id = Common::mb_substr($id, 0, $maxLen - $md5Len - 1) . md5($id);
}
$i = 0;