Skip to content

Enable indexer application locking by default #36956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: 2.4-develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/code/Magento/Indexer/Model/Indexer/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public function setIndexerId($value)
public function getStatus()
{
if ($this->isUseApplicationLock()) {
if (
parent::getStatus() == StateInterface::STATUS_WORKING &&
if (parent::getStatus() == StateInterface::STATUS_WORKING &&
!$this->lockManager->isLocked($this->lockPrefix . $this->getIndexerId())
) {
return StateInterface::STATUS_INVALID;
Expand Down Expand Up @@ -189,8 +188,8 @@ public function beforeSave()
*
* @return bool
*/
private function isUseApplicationLock()
private function isUseApplicationLock(): bool
{
return $this->configReader->get($this->useApplicationLockConfig) ?: false;
return (bool) ($this->configReader->get($this->useApplicationLockConfig) ?? true);
}
}
7 changes: 3 additions & 4 deletions app/code/Magento/Indexer/Model/Mview/View/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ public function getStatus()
{
$status = $this->getData('status');
if ($this->isUseApplicationLock()) {
if (
$status == \Magento\Framework\Mview\View\StateInterface::STATUS_WORKING &&
if ($status == \Magento\Framework\Mview\View\StateInterface::STATUS_WORKING &&
!$this->lockManager->isLocked($this->lockPrefix . $this->getViewId())
) {
return \Magento\Framework\Mview\View\StateInterface::STATUS_IDLE;
Expand Down Expand Up @@ -229,8 +228,8 @@ public function setVersionId($versionId)
*
* @return bool
*/
private function isUseApplicationLock()
private function isUseApplicationLock(): bool
{
return $this->configReader->get($this->useApplicationLockConfig) ?: false;
return (bool) ($this->configReader->get($this->useApplicationLockConfig) ?? true);
}
}