Skip to content

Commit

Permalink
Fixed #4136
Browse files Browse the repository at this point in the history
  • Loading branch information
andris-sevcenko committed May 10, 2019
1 parent ba5ad84 commit 7d5f4bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed a bug where rebuilding the project config could set an incorrect value for the user field layout.
- Fixed a bug Craft wouldn’t allow users to edit their own photos if they didn’t have upload/remove asset permissions.
- Fixed a bug where Craft wasn’t removing newline characters when pasting text into some single-line Table column types.
- Fixed a bug where project config syncing could have inconsistent results on load-balanced environments. ([](https://github.com/craftcms/cms/issues/4136))

## 3.1.26 - 2019-05-08

Expand Down
9 changes: 9 additions & 0 deletions src/services/ProjectConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,21 @@ public function regenerateYamlFromConfig()
*/
public function applyYamlChanges()
{
$mutex = Craft::$app->getMutex();
$lockName = 'project-config-sync';

if (!$mutex->acquire($lockName, 15)) {
throw new Exception('Could not acquire a lock for the syncing project config.');
}

$this->_applyingYamlChanges = true;
Craft::$app->getCache()->delete(self::CACHE_KEY);

$changes = $this->_getPendingChanges();

$this->_applyChanges($changes);

$mutex->release($lockName);
}

/**
Expand Down

0 comments on commit 7d5f4bf

Please sign in to comment.