diff --git a/vendor/magento/module-sales-archive/Plugin/AsyncGridUpdate.php b/vendor/magento/module-sales-archive/Plugin/AsyncGridUpdate.php new file mode 100644 index 000000000000..d7c136239781 --- /dev/null +++ b/vendor/magento/module-sales-archive/Plugin/AsyncGridUpdate.php @@ -0,0 +1,104 @@ +getGridTable(); + $subjectMainTable = $subject->getMainTable(); + } catch (\Exception $e) { + return; + } + if ($subjectGridTable === 'sales_order_grid' + && $subjectMainTable === self::ENTITIES_TABLE) { + while (true) { + $notSyncedIds = $this->notSyncedDataProvider->getIds( + self::ENTITIES_TABLE, + self::GRID_TABLE + ); + if (empty($notSyncedIds)) { + break; + } + foreach (array_chunk($notSyncedIds, $subject::BATCH_SIZE) as $bunch) { + $select = $subject->getGridOriginSelect() + ->where(self::ENTITIES_TABLE . '.entity_id IN (?)', $bunch); + $fetchResult = $subject->getConnection()->fetchAll($select); + $subject->getConnection()->insertOnDuplicate( + $subject->getTable(self::GRID_TABLE), + $fetchResult, + self::COLUMNS_TO_UPDATE + ); + } + } + } + } +} diff --git a/vendor/magento/module-sales-archive/etc/di.xml b/vendor/magento/module-sales-archive/etc/di.xml index da7394e247bc..a7b665388391 100644 --- a/vendor/magento/module-sales-archive/etc/di.xml +++ b/vendor/magento/module-sales-archive/etc/di.xml @@ -294,4 +294,12 @@ + + + + + + Magento\Sales\Model\ResourceModel\Provider\UpdatedAtListProvider + +