Mongo-php driver is not reconnecting after mongo atlas server is down due to server size increaese

We have a containerized laravel application in production that communicates with a mongo atlas database. When we upgrade, the server is down, apparently for a few minutes, but when it comes back up, the app is unable to reconnect to the database. Only when container is restarted.

It seems to be something related to DNS resolution.
We use connection string:
With the main host mongodb+srv://
With mongodb:// host replica

Both with X509 authentication and options like

serverSelectionTryOnce

We think it could be something like the controller storing the server’s IP behind the connection string and storing it to bypass DNS on future requests. Then after Atlas updates the server, maybe the IP is not the same anymore and that’s why the controller can’t communicate remotely.

Has anyone been through something similar? How do you handle reconnection to a remote mongo db in Atlas?

Thanks in advance!