func()

in swim/heal_via_discover_provider.go [66:90]


func (h *discoverProviderHealer) Start() {
	// check if started channel is already filled
	// if not, we start a new loop
	select {
	case h.started <- struct{}{}:
	default:
		return
	}

	go func() {
		for {
			// loop or quit
			select {
			case <-h.node.clock.After(h.period):
			case <-h.quit:
				return
			}

			// attempt heal with the pro
			if h.rand.Float64() < h.Probability() {
				h.Heal()
			}
		}
	}()
}