code: func (s *TranslateFile) monitorReplication() {
  	// Create context that will cancel on close.
  	ctx, cancel := context.WithCancel(context.Background())
  	go func() {
  		select {
  		case <-s.closing:
  		case <-s.replicationClosing:
  		}
  		cancel()
  	}()
  
  	// Keep attempting to replicate until the store closes.
  	for {
  		if err := s.replicate(ctx); err != nil {
  			s.logger.Printf("pilosa: replication error: %s", err)
  		}
  		select {
  		case <-ctx.Done():
  			return
  		case <-time.After(s.replicationRetryInterval):
  			s.logger.Printf("pilosa: reconnecting to primary replica")
  		}
  	}
  }
docs: // monitorReplication is executed in a separate goroutine and continually streams
  // from the primary store until this store is closed.