Recovering failed connections with replicasets and failover is fairly easy to centralize
But there can be some pretty crazy latency with the rediscovery. If the driver connects to a secondary and later tries a write it will fail.
In this case the write should really be retried. Sure you could do this by wrapping monga in another class (sigh) but it would be far more elegant to simply catch MongoCursorExceptions and look for the "not master" failure for inserts/saves and retry
Silly github lost the rest!
Recovering failed connections with replicasets and failover is fairly easy to centralize
But there can be some pretty crazy latency with the rediscovery. If the driver connects to a secondary and later tries a write it will fail.
In this case the write should really be retried. Sure you could do this by wrapping monga in another class (sigh) but it would be far more elegant to simply catch MongoCursorExceptions and look for the "not master" failure for inserts/saves and retry