Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Removing notes about doctrine_clear_entity_manager middleware #12575

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

Merged
merged 1 commit into from
Nov 2, 2019

Conversation

weaverryan
Copy link
Member

See symfony/symfony#34156

That class was added in 4.4... then removed for 4.4 - so it was never released.

I don't think the new "subscriber" added there needs docs - I'll open a PR in DoctrineBundle so that it's (ideally) enabled by default. I see this more as a bug fix that should... just work without you knowing/caring.

@weaverryan weaverryan added the Waiting Code Merge Docs for features pending to be merged label Oct 31, 2019
fabpot added a commit to symfony/symfony that referenced this pull request Oct 31, 2019
…eset EM in worker (weaverryan)

This PR was merged into the 4.4 branch.

Discussion
----------

Adding DoctrineClearEntityManagerWorkerSubscriber to reset EM in worker

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes & no :)
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #34073
| License       | MIT
| Doc PR        | symfony/symfony-docs#12575
| DoctrineBundle PR | doctrine/DoctrineBundle#1043

Hi!

I've seen a few developers get "bit" by an issue recently: after running `messenger:consume`, the 2nd, 3rd, 4th, etc message that are handled are getting out-of-date data from Doctrine. The reason is simple:

A) Consume the 1st message, it queries for `Foo id=1` to do something
B) 10 minutes go by
C) Consume the 2nd message. It also queries for `Foo id=1`, but because this is already in the identity map, Doctrine re-uses the data that is now *10* minutes old.

Even though one worker process handles many messages, the system should (as much as possible) isolate each handler from each other. This is one very practical place we can help people. Also, checking the code, I don't think clearing the entity manager will cause any issues for an EM whose Connection has not been "connected" yet (i.e. it will not cause a connection to be established).

We would wire this in DoctrineBundle, and could make it disable-able... in case that's something that's needed.

Commits
-------

e7b9888 Adding DoctrineClearEntityManagerWorkerSubscriber to reset entity manager in worker
@weaverryan weaverryan removed the Waiting Code Merge Docs for features pending to be merged label Nov 1, 2019
@weaverryan weaverryan changed the title [WCM] Removing notes about doctrine_clear_entity_manager middleware Removing notes about doctrine_clear_entity_manager middleware Nov 1, 2019
@weaverryan weaverryan added this to the 4.4 milestone Nov 1, 2019
@weaverryan
Copy link
Member Author

Ready to go now

@OskarStark
Copy link
Contributor

Thanks Ryan.

OskarStark added a commit that referenced this pull request Nov 2, 2019
…eware (weaverryan)

This PR was merged into the 4.4 branch.

Discussion
----------

Removing notes about doctrine_clear_entity_manager middleware

See symfony/symfony#34156

That class was added in 4.4... then removed for 4.4 - so it was never released.

I don't think the new "subscriber" added there needs docs - I'll open a PR in DoctrineBundle so that it's (ideally) enabled by default. I see this more as a bug fix that should... just work without you knowing/caring.

Commits
-------

fdf457a removing notes about doctrine_clear_entity_manager middleware
@OskarStark OskarStark merged commit fdf457a into symfony:4.4 Nov 2, 2019
@weaverryan weaverryan deleted the doctrine-ping-middleware-change branch November 4, 2019 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants