feat: add an automatic reindex manager to enable or disable event
fix: reset the dispatch flag in the event subscribe on clear event
For example, when we have an import product service and have multiple flush, we want to send a reindex message at the end manually. Now, is it possible:
...
// Disable the automatic product search reindex
$this->automaticProductReindexManager->shouldAutomaticallyReindex(false);
...
// Dispatch a message to reindex my current product
$productReindexFromIdsMessage = new ProductReindexFromIds();
$productReindexFromIdsMessage->addProductId($product->getId());
$this->messageBus->dispatch($productReindexFromIdsMessage);
// Re-enable the automatic product search reindex
$this->automaticProductReindexManager->shouldAutomaticallyReindex(true);
For example, when we have an import product service and have multiple flush, we want to send a reindex message at the end manually. Now, is it possible: