code: func (p *Process) ping(addr string, timeout time.Duration) error {
  	// Default to local process if addr not specified.
  	if addr == "" {
  		addr = fmt.Sprintf("localhost:%s", p.Port)
  	}
  
  	logger := p.Logger.New("fn", "ping", "addr", addr, "timeout", timeout)
  	logger.Info("sending")
  
  	timer := time.NewTimer(timeout)
  	defer timer.Stop()
  
  	ticker := time.NewTicker(checkInterval)
  	defer ticker.Stop()
  
  	for {
  		// Attempt to ping the server.
  		if ok := func() bool {
  			logger.Info("sending PING")
  
  			conn, err := redis.Dial("tcp", addr,
  				redis.DialPassword(p.Password),
  				redis.DialConnectTimeout(timeout),
  				redis.DialReadTimeout(timeout),
  				redis.DialWriteTimeout(timeout),
  			)
  			if err != nil {
  				logger.Error("conn error", "err", err)
  				return false
  			}
  			defer conn.Close()
  
  			if _, err := conn.Do("PING"); err != nil {
  				logger.Error("error getting upstream status", "err", err)
  				return false
  			}
  
  			logger.Info("PONG received")
  			return true
  		}(); ok {
  			return nil
  		}
  
  		select {
  		case <-timer.C:
  			logger.Info("timeout")
  			return ErrTimeout
  		case <-ticker.C:
  		}
  	}
  }
docs: // ping executes a PING command against addr until timeout occurs.