-
Notifications
You must be signed in to change notification settings - Fork 39
Description
There is a race condition in time-based indexes. It's related to the fact that when multiple requests through the transaction API try to add products, it can happen that request A changes the alias in OS/ES, while request B doesn't have this state, which causes products to be added incorrectly (it may create the wrong index and add products to it).
The only possible solution to this is that products must be added in a more synchronous manner. Therefore, my idea, which I discussed with my team and which they made improvements to, is this: when the time-based indexes option is selected, queue them in Redis per collection. Then, after a specified time (e.g., 30 seconds) or number of products (e.g., 50), perform a bulk operation that will call the search_engine code, which will push them in bulks per collection. This way, race conditions will be avoided. I would add the script that pushes products from Redis to this repository.