Skip to content

Conversation

@sad270
Copy link
Contributor

@sad270 sad270 commented Dec 3, 2025

fix: #2154

@stof
Copy link
Member

stof commented Dec 3, 2025

Closing the connection is better than forcing to connect to the replica. If the next request starts with something that needs to use the primary, it will avoid connecting for nothing (same if the next request does not use the DB at all btw).

@stof
Copy link
Member

stof commented Dec 3, 2025

As discussed in the issue, this requires being careful with the case of messenger consumers using the doctrine transport. The transport will not like a connection getting closed between message as the transport has a longer lifecycle.

@sad270
Copy link
Contributor Author

sad270 commented Dec 3, 2025

There is a --no-reset option on symfony messenger, if we don't want to reset, but the option will not reset all the symfony resetable services. 🤔

Maybe in the configuration we should add a "close_on_reset" configuration (or something like). If it is true, we close the connection on kernel reset. And for the backward compatibility we set a default value to false

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.

WorkerMode with Primary Replica Database will not switch back to replica connection

3 participants