Skip to content

[Elastica] The SyncIndexWithObjectChangeProcessor cannot update an entity more than once #823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
philmoreau opened this issue Apr 12, 2019 · 4 comments
Labels

Comments

@philmoreau
Copy link

When many updates to the same entity are queued, the SyncIndexWithObjectChangeProcessor will always keep the first representation of an entity that it fetched from Doctrine, causing all subsequent updates to resend exactly the same data.

This happens because Doctrine's manager keeps a cached version of the entity and reuses that version for subsequent calls to "find".

The solution is to clear all managed entities so Doctrine will re-fetch the entity from the database.

I will submit a PR.

@philmoreau
Copy link
Author

@makasim
Copy link
Member

makasim commented May 21, 2019

The doctrine clear extension could be used.

@philmoreau
Copy link
Author

I hadn't noticed there was an extension for that, thanks!

Just wondering, is there a reason why the extension's behaviour isn't the default? Wouldn't it make sense to always fetch the entity's latest state, especially since this processor is called when an update is made?

@makasim
Copy link
Member

makasim commented May 21, 2019

Not everyone uses doctrine so enabling the ext by default might cause more trouble than it solves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants