Much more robust handling of replication failures and detecting when
we're back online.