Skip to content

Commit 619be65

Browse files
author
Shlomi Noach
committed
Merge pull request #29 from github/status-eta
Adding ETA starting at 2% progress
2 parents ee673e2 + 6528010 commit 619be65

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

go/logic/migrator.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,18 @@ func (this *Migrator) printStatus() {
550550
eta := "N/A"
551551
if isThrottled, throttleReason := this.migrationContext.IsThrottled(); isThrottled {
552552
eta = fmt.Sprintf("throttled, %s", throttleReason)
553+
} else if progressPct > 100.0 {
554+
eta = "Due"
555+
} else if progressPct >= 2.0 {
556+
elapsedRowCopySeconds := this.migrationContext.ElapsedRowCopyTime().Seconds()
557+
totalExpectedSeconds := elapsedRowCopySeconds * float64(rowsEstimate) / float64(totalRowsCopied)
558+
etaSeconds := totalExpectedSeconds - elapsedRowCopySeconds
559+
etaDuration := time.Duration(etaSeconds) * time.Second
560+
if etaDuration >= 0 {
561+
eta = base.PrettifyDurationOutput(etaDuration)
562+
} else {
563+
eta = "Due"
564+
}
553565
}
554566
status := fmt.Sprintf("Copy: %d/%d %.1f%%; Applied: %d; Backlog: %d/%d; Elapsed: %+v(copy), %+v(total); ETA: %s",
555567
totalRowsCopied, rowsEstimate, progressPct,

0 commit comments

Comments
 (0)