FriendsOfSymfony/FOSElasticaBundle — pull request #546 by bobvandevijver (2014-04-12 11:39:29+00:00)
Title: Fixes multiple updates on multiple flush executions

Imagine the following situation:
I've got a sync with an external database, which syncs about 30.000 persons every night. The persons are also in the Elastic db for fast searching, and I want to update automatically when needed. However, the update to Elastic takes up more and more memory after every update, and executes every update multiple times.

This is caused by the persistScheduled command. This is called on every flush execution, which is done a lot during our sync. But as the scheduled queue for persist/update/delete is not cleared after the persist action to Elastic, every flush command accumulates more and more updates which finally causes the script to run out of memory.

This PR clears the scheduled list after the update is done. This should insure much less memory usage and faster execution when using multiple flush commands.