Fix issue where the slave will stop working if the database connection is lost