@@ -902,38 +902,13 @@ func (this *Migrator) printMigrationStatusHint(writers ...io.Writer) {
902
902
}
903
903
}
904
904
905
- // shouldPrintStatus returns true when the migrator is due to print status info.
906
- func (this * Migrator ) shouldPrintStatus (rule PrintStatusRule , elapsedSeconds int64 , etaDuration time.Duration ) (shouldPrint bool ) {
907
- if rule != HeuristicPrintStatusRule {
908
- return true
909
- }
910
-
911
- etaSeconds := etaDuration .Seconds ()
912
- if elapsedSeconds <= 60 {
913
- shouldPrint = true
914
- } else if etaSeconds <= 60 {
915
- shouldPrint = true
916
- } else if etaSeconds <= 180 {
917
- shouldPrint = (elapsedSeconds % 5 == 0 )
918
- } else if elapsedSeconds <= 180 {
919
- shouldPrint = (elapsedSeconds % 5 == 0 )
920
- } else if this .migrationContext .TimeSincePointOfInterest ().Seconds () <= 60 {
921
- shouldPrint = (elapsedSeconds % 5 == 0 )
922
- } else {
923
- shouldPrint = (elapsedSeconds % 30 == 0 )
924
- }
925
-
926
- return shouldPrint
927
- }
928
-
929
- // shouldPrintMigrationStatus returns true when the migrator is due to print the migration status hint
930
- func (this * Migrator ) shouldPrintMigrationStatusHint (rule PrintStatusRule , elapsedSeconds int64 ) (shouldPrint bool ) {
931
- if elapsedSeconds % 600 == 0 {
932
- shouldPrint = true
933
- } else if rule == ForcePrintStatusAndHintRule {
934
- shouldPrint = true
905
+ // getProgressPercent returns an estimate of migration progess as a percent.
906
+ func (this * Migrator ) getProgressPercent (rowsEstimate int64 ) (progressPct float64 ) {
907
+ progressPct = 100.0
908
+ if rowsEstimate > 0 {
909
+ progressPct *= float64 (this .migrationContext .GetTotalRowsCopied ()) / float64 (rowsEstimate )
935
910
}
936
- return shouldPrint
911
+ return progressPct
937
912
}
938
913
939
914
// getMigrationETA returns the estimated duration of the migration
@@ -981,13 +956,38 @@ func (this *Migrator) getMigrationStateAndETA(rowsEstimate int64) (state, eta st
981
956
return state , eta , etaDuration
982
957
}
983
958
984
- // getProgressPercent returns an estimate of migration progess as a percent.
985
- func (this * Migrator ) getProgressPercent (rowsEstimate int64 ) (progressPct float64 ) {
986
- progressPct = 100.0
987
- if rowsEstimate > 0 {
988
- progressPct *= float64 (this .migrationContext .GetTotalRowsCopied ()) / float64 (rowsEstimate )
959
+ // shouldPrintStatus returns true when the migrator is due to print status info.
960
+ func (this * Migrator ) shouldPrintStatus (rule PrintStatusRule , elapsedSeconds int64 , etaDuration time.Duration ) (shouldPrint bool ) {
961
+ if rule != HeuristicPrintStatusRule {
962
+ return true
989
963
}
990
- return progressPct
964
+
965
+ etaSeconds := etaDuration .Seconds ()
966
+ if elapsedSeconds <= 60 {
967
+ shouldPrint = true
968
+ } else if etaSeconds <= 60 {
969
+ shouldPrint = true
970
+ } else if etaSeconds <= 180 {
971
+ shouldPrint = (elapsedSeconds % 5 == 0 )
972
+ } else if elapsedSeconds <= 180 {
973
+ shouldPrint = (elapsedSeconds % 5 == 0 )
974
+ } else if this .migrationContext .TimeSincePointOfInterest ().Seconds () <= 60 {
975
+ shouldPrint = (elapsedSeconds % 5 == 0 )
976
+ } else {
977
+ shouldPrint = (elapsedSeconds % 30 == 0 )
978
+ }
979
+
980
+ return shouldPrint
981
+ }
982
+
983
+ // shouldPrintMigrationStatus returns true when the migrator is due to print the migration status hint
984
+ func (this * Migrator ) shouldPrintMigrationStatusHint (rule PrintStatusRule , elapsedSeconds int64 ) (shouldPrint bool ) {
985
+ if elapsedSeconds % 600 == 0 {
986
+ shouldPrint = true
987
+ } else if rule == ForcePrintStatusAndHintRule {
988
+ shouldPrint = true
989
+ }
990
+ return shouldPrint
991
991
}
992
992
993
993
// printStatus prints the progress status, and optionally additionally detailed
0 commit comments