cleanup v4

This commit is contained in:
Tim Vaillancourt 2022-07-07 05:05:37 +02:00
parent c3593c94ff
commit eead61cb6d
3 changed files with 7 additions and 14 deletions

View File

@ -345,8 +345,7 @@ func (this *Applier) InitiateHeartbeat() {
ticker := time.NewTicker(time.Duration(this.migrationContext.HeartbeatIntervalMilliseconds) * time.Millisecond)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}

View File

@ -813,8 +813,7 @@ func (this *Migrator) initiateStatus() {
this.printStatus(ForcePrintStatusAndHintRule)
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}
@ -1054,8 +1053,7 @@ func (this *Migrator) initiateStreaming() error {
go func() {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}

View File

@ -170,8 +170,7 @@ func (this *Throttler) collectReplicationLag(firstThrottlingCollected chan<- boo
ticker := time.NewTicker(time.Duration(this.migrationContext.HeartbeatIntervalMilliseconds) * time.Millisecond)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}
@ -328,8 +327,7 @@ func (this *Throttler) collectThrottleHTTPStatus(firstThrottlingCollected chan<-
collectInterval := time.Duration(this.migrationContext.ThrottleHTTPIntervalMillis) * time.Millisecond
ticker := time.NewTicker(collectInterval)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}
@ -450,8 +448,7 @@ func (this *Throttler) initiateThrottlerCollection(firstThrottlingCollected chan
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}
@ -482,8 +479,7 @@ func (this *Throttler) initiateThrottlerChecks() {
ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()
for {
<-ticker.C
for range ticker.C {
if atomic.LoadInt64(&this.finishedMigrating) > 0 {
return
}