Fixes multiple updates on multiple flush executions
This commit is contained in:
parent
f93a7d278f
commit
449c33aea3
|
@ -258,17 +258,21 @@ class Listener implements EventSubscriber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persist scheduled objects to ElasticSearch
|
* Persist scheduled objects to ElasticSearch
|
||||||
|
* After persisting, clear the scheduled queue to prevent multiple data updates when using multiple flush calls
|
||||||
*/
|
*/
|
||||||
private function persistScheduled()
|
private function persistScheduled()
|
||||||
{
|
{
|
||||||
if (count($this->scheduledForInsertion)) {
|
if (count($this->scheduledForInsertion)) {
|
||||||
$this->objectPersister->insertMany($this->scheduledForInsertion);
|
$this->objectPersister->insertMany($this->scheduledForInsertion);
|
||||||
|
$this->scheduledForInsertion = array();
|
||||||
}
|
}
|
||||||
if (count($this->scheduledForUpdate)) {
|
if (count($this->scheduledForUpdate)) {
|
||||||
$this->objectPersister->replaceMany($this->scheduledForUpdate);
|
$this->objectPersister->replaceMany($this->scheduledForUpdate);
|
||||||
|
$this->scheduledForUpdate = array();
|
||||||
}
|
}
|
||||||
if (count($this->scheduledForDeletion)) {
|
if (count($this->scheduledForDeletion)) {
|
||||||
$this->objectPersister->deleteManyByIdentifiers($this->scheduledForDeletion);
|
$this->objectPersister->deleteManyByIdentifiers($this->scheduledForDeletion);
|
||||||
|
$this->scheduledForDeletion = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue