def promote_new_master(snapshots, node = nil)
      delete_path(redis_nodes_path)
      @master = nil

      # make a specific node or selected candidate the new master
      candidate = node || failover_strategy_candidate(snapshots)

      if candidate.nil?
        logger.error('Failed to promote a new master, no candidate available.')
      else
        @slaves.delete(candidate)
        @unavailable.delete(candidate)
        redirect_slaves_to(candidate)
        candidate.make_master!
        @master = candidate
        write_current_redis_nodes
        @master_promotion_attempts = 0
        logger.info("Successfully promoted #{candidate} to master.")
      end
    end
def promote_new_master(snapshots, node = nil)
      delete_path(redis_nodes_path)
      @master = nil

      # make a specific node or selected candidate the new master
      candidate = node || failover_strategy_candidate(snapshots)

      if candidate.nil?
        logger.error('Failed to promote a new master, no candidate available.')
      else
        @slaves.delete(candidate)
        @unavailable.delete(candidate)
        redirect_slaves_to(candidate)
        candidate.make_master!
        @master = candidate
        write_current_redis_nodes
        @master_promotion_attempts = 0
        logger.info("Successfully promoted #{candidate} to master.")
      end
    end
Promotes a new master.

 @param [Hash<Node, NodeSnapshot>] snapshots the current set of snapshots
 @param [Node] node the optional node to promote