FOSElasticaBundle icon indicating copy to clipboard operation
FOSElasticaBundle copied to clipboard

Different persist order in direct and asynchronous (defer) mode

Open graundas opened this issue 6 years ago • 0 comments

Hello. I found a different persist order behaviour in direct (defer: false) and asynchronous (defer: true) modes. If you look at the persistScheduled() method in src/Doctrine/Listener.php class, you will see, that there is no implementation for the correct persist order.

Use case: START TRANSACTION; Delete entity from Elasticsearch database; THROW Exception; CATCH Exception and manually Insert the same entity again into the Elasticsearch database. ROLLBACK;

In the direct mode this entity is deleted, and then populated again into the Elasticsearch database. In asynchronous mode this entity is firstly populated and then deleted (the reason is in the persistScheduled() method).

I think this bad behaviour should be highlighted in the docs. Do you think, that this behaviour in async mode should be fixed?

graundas avatar Jan 17 '19 17:01 graundas