// Repeat returns the receiver, repeated a number of times.
511669
func (r Rope) Repeat(count int64) Rope {
	// Special cases:
	switch count {
	case 0:
		return emptyRope
	case 1:
		return r
	}

	// General case:
	orig := r
	r = r.Repeat(count / 2)
	r = r.Append(r)
	if count%2 == 1 {
		return r.Append(orig)
	}
	return balanced(r)
}
1189551
func (s *Sender) SendWithRetries(msg *Message, to string, retries int) (result *Result, err error) {
	if err := checkUnrecoverableErrors(s, to, nil, msg, retries); err != nil {
		return nil, err
	}
	attempt, backoff := 0, BackoffInitialDelay
	for {
		attempt++
		result, err = s.SendNoRetry(msg, to)
		// NOTE: partial success for a device group message is considered successful

		tryAgain := false
		if attempt <= retries {
			if result != nil && (result.Error == ErrorUnavailable || result.Error == ErrorInternalServerError) {
				tryAgain = true
			} else if err != nil {
				if httpErr, isHTTPErr := err.(httpError); isHTTPErr {
					tryAgain = httpErr.statusCode >= http.StatusInternalServerError && httpErr.statusCode < 600
				}
			}
		}

		if tryAgain {
			sleepTime := backoff/2 + rand.Intn(backoff)
			time.Sleep(time.Duration(sleepTime) * time.Millisecond)
			backoff = min(2*backoff, MaxBackoffDelay)
		} else {
			break
		}
	}
	return
}
735050
func RepeatEvent(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "repeatEvent", Listener: listener}
}
704105
func (w *Watcher) loop() error {
	var err error
	if w.delta, err = clockDelta(w.base); err != nil {
		return errors.Trace(err)
	}
	// Always sync before handling request.
	if err := w.sync(); err != nil {
		return errors.Trace(err)
	}
	w.next = time.After(time.Duration(period) * time.Second)
	for {
		select {
		case <-w.tomb.Dying():
			return errors.Trace(tomb.ErrDying)
		case <-w.next:
			w.next = time.After(time.Duration(period) * time.Second)
			syncDone := w.syncDone
			w.syncDone = nil
			if err := w.sync(); err != nil {
				return errors.Trace(err)
			}
			w.flush()
			for _, done := range syncDone {
				close(done)
			}
			w.syncsSinceLastPrune++
			w.checkShouldPrune()
		case req := <-w.request:
			w.handle(req)
			w.flush()
		}
	}
}
1006464
func (rs Recoverings) Frequency(num int, dur time.Duration) bool {
	if len(rs) >= num {
		first := rs[len(rs)-num].Time
		last := rs[len(rs)-1].Time
		return last.Sub(first) <= dur
	}
	return false
}
961360
func (c *Call) Times(i int) *Call {
	c.lock()
	defer c.unlock()
	c.Repeatability = i
	return c
}
427689
function _repeat (source, times) {
    var result = "";

    for (var i = 0; i < times; i++) {
        result += source;
    }

    return result;
}
1132646
func (limit *simpleLimiter) Count(n int) error {
	now := time.Now()
	if now.After(limit.timeRead) {
		limit.numRead = 0
		limit.timeRead = now.Add(limit.Frequency)
	}
	limit.numRead += n
	if limit.numRead > limit.Amount {
		return ErrRateExceeded
	}
	return nil
}
752781
func (e *eventer) Once(n string, f func(s interface{})) (err error) {
	out := e.Subscribe()
	go func() {
	ProcessEvents:
		for evt := range out {
			if evt.Name == n {
				f(evt.Data)
				e.Unsubscribe(out)
				break ProcessEvents
			}
		}
	}()

	return
}
866596
func (h *sentPacketHistory) Iterate(cb func(*Packet) (cont bool, err error)) error {
	cont := true
	for el := h.packetList.Front(); cont && el != nil; el = el.Next() {
		var err error
		cont, err = cb(&el.Value)
		if err != nil {
			return err
		}
	}
	return nil
}
23704
func (m *Broadcaster) loop() {
	// Deliberately not catching crashes here. Yes, bring down the process if there's a
	// bug in watch.Broadcaster.
	for {
		event, ok := <-m.incoming
		if !ok {
			break
		}
		if event.Type == internalRunFunctionMarker {
			event.Object.(functionFakeRuntimeObject)()
			continue
		}
		m.distribute(event)
	}
	m.closeAll()
	m.distributing.Done()
}
555556
func (pool *Pool) Replicate(replicate int) *Pool {
	pool.conf.Replicate = replicate
	return &Pool{redis: pool.redis, conf: pool.conf}
}
1245165
func Repeat(v interface{}, length int) T {
	if length < 0 {
		length = 0
	}
	rv := reflect.ValueOf(v)
	out := reflect.MakeSlice(reflect.SliceOf(rv.Type()), length, length)
	for i := 0; i < length; i++ {
		out.Index(i).Set(rv)
	}
	return out.Interface()
}
322494
func (b *bufferedBody) rewind() error {
	if b == nil {
		return nil
	}
	_, err := b.Seek(0, io.SeekStart)
	return err
}
1339951
func repeatHelper(count int, text string, sep string) string {
	var res bytes.Buffer

	for i := 0; i < count; i++ {
		if i > 0 {
			res.WriteString(sep)
		}
		res.WriteString(strings.Replace(text, "%d", fmt.Sprintf("%d", i), -1))
	}

	return res.String()
}
1174897
func (s *ServerReplicationParameters) SetFrequency(v int64) *ServerReplicationParameters {
	s.Frequency = &v
	return s
}
200484
func (b *tableBatch) Replay(w ethdb.Writer) error {
	return b.batch.Replay(w)
}