Skip to content

[Messenger] run "ping database connection" Doctrine middleware with the new alarm based event #60109

@dkarlovi

Description

@dkarlovi

Symfony version(s) affected

7.3.x

Description

Let's assume you're not using Doctrine as your Messenger transport, but you are using Doctrine ORM.

The latest alarm based features added by @HypeMC in #53533 and #53508 provided a way to refresh the transports, and this got expanded to Doctrine too in #59601.

But, the Doctrine middleware is does not honor this and Doctrine will only get refreshed by the alarm if you're using Doctrine as your Messenger transport too.

Example:

  1. use Beanstalk (or any other transport except Doctrine) as your Messenger transport
  2. use Doctrine ORM as usual, enable the middleware
  3. message comes in, Doctrine middleware runs to refresh the connection
  4. processing the message takes say 10min
  5. the alarm keeps triggering and the Beanstalk connection is getting refreshed, but not Doctrine's
  6. before the message is processed, the end result needs to be written into the DB, but the database connection is closed by the server due to 10min idle (it was refreshed on message arrival)

How to reproduce

See above.

Possible Solution

If you've enabled the Doctrine middleware, it should get triggered by the alarm too.

Additional Context

Technically, the original intent of #47920 was not solved.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions