You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is that during a long or nested transaction, the sendUpdateIndexMessage() is called during a postPersist event, while the data may not yet be available in the database. The subsequent processing of the sent message (Doctrine/Queue/SyncIndexWithObjectChangeProcessor.php line 87) does not find the object and will send a delete command to Elastic instead of an insert.
This happens for example during a Doctrine fixtures load, which is actually several flushes inside nested transactions, but I have also seen it happen during a simple request (with queued processing). The problem is that the message is sent before the $conn->commit() is done in the (outer-)transaction's flush call. So none of the Doctrine lifecycle events is gonna guarantee there will be no race conditions.
The solution imo is to allow the message to be delivered with a delay.