// initiateThrottlerChecks initiates the throttle ticker and sets the basic behavior of throttling.
initiateThrottlerChecks initiates the throttle ticker and sets the basic behavior of throttling.
// initiateThrottlerChecks initiates the throttle ticker and sets the basic behavior of throttling .
func (this *Throttler) initiateThrottlerChecks() error {
	throttlerTick := time.Tick(100 * time.Millisecond)
	throttlerFunction := func() {
		alreadyThrottling, currentReason := this.migrationContext.IsThrottled()
		shouldThrottle, throttleReason := this.shouldThrottle()
		if shouldThrottle && !alreadyThrottling {
			this.applier.WriteAndLogChangelog("throttle", throttleReason)
		} else if shouldThrottle && alreadyThrottling && (currentReason != throttleReason) {
			this.applier.WriteAndLogChangelog("throttle", throttleReason)
		} else if alreadyThrottling && !shouldThrottle {
			this.applier.WriteAndLogChangelog("throttle", "done throttling")
		}
		this.migrationContext.SetThrottled(shouldThrottle, throttleReason)
	}
	throttlerFunction()
	for range throttlerTick {
		throttlerFunction()
	}
	return nil
}
func ( this * Throttler ) initiateThrottlerChecks ( ) error { throttlerTick := time . Tick ( 100 * time . Millisecond ) throttlerFunction := func ( ) { alreadyThrottling , currentReason := this . migrationContext . IsThrottled ( ) shouldThrottle , throttleReason := this . shouldThrottle ( ) if shouldThrottle && ! alreadyThrottling { this . applier . WriteAndLogChangelog ( " " , throttleReason ) } else if shouldThrottle && alreadyThrottling && ( currentReason != throttleReason ) { this . applier . WriteAndLogChangelog ( " " , throttleReason ) } else if alreadyThrottling && ! shouldThrottle { this . applier . WriteAndLogChangelog ( " " , " " ) } this . migrationContext . SetThrottled ( shouldThrottle , throttleReason ) } throttlerFunction ( ) for range throttlerTick { throttlerFunction ( ) } return nil }
initiateThrottlerChecks initiates the throttle ticker and sets the basic behavior of throttling.
initiateThrottlerChecks initiates the throttle ticker and sets the basic behavior of throttling .
// New throttling // Change of reason // End of throttling