Skip to content
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

[BridgeDoctrineMessenger] Doctrine ping connection middleware #31061

Open

Conversation

Projects
None yet
8 participants
@insidestyles
Copy link
Contributor

commented Apr 10, 2019

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...
  • Check and reconnect if mysql has gone away:

      <service id="messenger.middleware.doctrine_ping_connection" class="Symfony\Bridge\Doctrine\Messenger\DoctrinePingConnectionMiddleware" public="false">
          <argument type="service" id="doctrine" />
      </service>
    
  • Close and save opened connections (not active worker):

      <service id="messenger.middleware.doctrine_close_connection" class="Symfony\Bridge\Doctrine\Messenger\DoctrineCloseConnectionMiddleware" public="false">
          <argument type="service" id="doctrine" />
      </service>
    

@insidestyles insidestyles force-pushed the insidestyles:feature/doctrine-ping-connection-middleware branch from 452dba4 to 11c4a4b Apr 11, 2019

@nicolas-grekas nicolas-grekas added this to the next milestone Apr 11, 2019

@insidestyles insidestyles force-pushed the insidestyles:feature/doctrine-ping-connection-middleware branch from 6236dd7 to 58e0480 Apr 11, 2019

@insidestyles insidestyles force-pushed the insidestyles:feature/doctrine-ping-connection-middleware branch from 58e0480 to 5fa2957 Apr 11, 2019

@sroze
Copy link
Member

left a comment

It's a good idea. One simple comment.

Also, can you open a WIP pull-request on the DoctrineBundle as well so the service messenger.middleware.doctrine_ping_connection would be available by default? Maybe we should provide two services with the different values of forceCloseConnection?

{
private $managerRegistry;
private $entityManagerName;
private $forceCloseConnection = false;

This comment has been minimized.

Copy link
@sroze

sroze Apr 22, 2019

Member

You don't need this default value as it's given by the constructor.

This comment has been minimized.

Copy link
@insidestyles

insidestyles Apr 22, 2019

Author Contributor

As you said, I think that creating 2 separated middlewares is better. Is it ok?

@sroze

This comment has been minimized.

Copy link
Member

commented Apr 22, 2019

As long as it’s clear in your documentation PR I think it’s okay 👍

@sroze

This comment has been minimized.

Copy link
Member

commented Apr 22, 2019

@insidestyles what I meant is only one class here but two service definitions within the DoctrineBundle where you need to register the services (in the messenger.xml).

@insidestyles

This comment has been minimized.

Copy link
Contributor Author

commented Apr 22, 2019

@insidestyles what I meant is only one class here but two service definitions within the DoctrineBundle where you need to register the services (in the messenger.xml).

I understood. Should I revert the last commit?

I also created doctrine/DoctrineBundle#956

@alcaeus

This comment has been minimized.

Copy link
Contributor

commented Apr 23, 2019

@sroze what Symfony version are you targeting with this? Is this still eligible for 4.3 or will this land in 4.4 by default?

@fabpot

This comment has been minimized.

Copy link
Member

commented Apr 24, 2019

I will stop merging new features for 4.3 probably at the end of the week. But I would really like this one to be part of 4.3 :) We need some approvals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.