Skip to content

Commit a54e23f

Browse files
committed
Reset mview status on unsubscribe
This fixes a problem where mview gets "stuck" if interrupted, for example during deployment.
1 parent 2558328 commit a54e23f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

lib/internal/Magento/Framework/Mview/Test/Unit/ViewTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ public function testUnsubscribe()
244244
->method('setMode')
245245
->with(StateInterface::MODE_DISABLED)
246246
->will($this->returnSelf());
247+
$this->stateMock->expects($this->once())
248+
->method('setStatus')
249+
->with(StateInterface::STATUS_IDLE)
250+
->will($this->returnSelf());
247251
$this->changelogMock->expects($this->once())
248252
->method('drop');
249253
$subscriptionMock = $this->createPartialMock(Subscription::class, ['remove']);
@@ -271,6 +275,8 @@ public function testUnsubscribeDisabled()
271275
->method('setVersionId');
272276
$this->stateMock->expects($this->never())
273277
->method('setMode');
278+
$this->stateMock->expects($this->never())
279+
->method('setStatus');
274280
$this->changelogMock->expects($this->never())
275281
->method('drop');
276282
$this->subscriptionFactoryMock->expects($this->never())

lib/internal/Magento/Framework/Mview/View.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,10 @@ public function unsubscribe()
235235
}
236236

237237
// Update view state
238-
$this->getState()->setMode(View\StateInterface::MODE_DISABLED)->save();
238+
$this->getState()
239+
->setMode(View\StateInterface::MODE_DISABLED)
240+
->setStatus(View\StateInterface::STATUS_IDLE)
241+
->save();
239242
}
240243

241244
return $this;

0 commit comments

Comments
 (0)