N/A denoted by negative value
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
This commit is contained in:
parent
51719a2b76
commit
76b9c16a68
@ -483,6 +483,11 @@ func (this *MigrationContext) SetETADuration(etaDuration time.Duration) {
|
||||
atomic.StoreInt64(&this.etaNanoseonds, etaDuration.Nanoseconds())
|
||||
}
|
||||
|
||||
func (this *MigrationContext) GetETASeconds() int64 {
|
||||
nano := atomic.LoadInt64(&this.etaNanoseonds)
|
||||
return nano / int64(time.Second)
|
||||
}
|
||||
|
||||
// math.Float64bits([f=0..100])
|
||||
|
||||
// GetTotalRowsCopied returns the accurate number of rows being copied (affected)
|
||||
|
@ -66,7 +66,7 @@ func (this *HooksExecutor) applyEnvironmentVariables(extraVariables ...string) [
|
||||
env = append(env, fmt.Sprintf("GH_OST_INSPECTED_LAG=%f", this.migrationContext.GetCurrentLagDuration().Seconds()))
|
||||
env = append(env, fmt.Sprintf("GH_OST_HEARTBEAT_LAG=%f", this.migrationContext.TimeSinceLastHeartbeatOnChangelog().Seconds()))
|
||||
env = append(env, fmt.Sprintf("GH_OST_PROGRESS=%f", this.migrationContext.GetProgressPct()))
|
||||
env = append(env, fmt.Sprintf("GH_OST_ETA_NANOSECONDS=%d", this.migrationContext.GetETADuration().Nanoseconds()))
|
||||
env = append(env, fmt.Sprintf("GH_OST_ETA_SECONDS=%d", this.migrationContext.GetETASeconds()))
|
||||
env = append(env, fmt.Sprintf("GH_OST_HOOKS_HINT=%s", this.migrationContext.HooksHintMessage))
|
||||
env = append(env, fmt.Sprintf("GH_OST_HOOKS_HINT_OWNER=%s", this.migrationContext.HooksHintOwner))
|
||||
env = append(env, fmt.Sprintf("GH_OST_HOOKS_HINT_TOKEN=%s", this.migrationContext.HooksHintToken))
|
||||
|
@ -939,7 +939,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
|
||||
}
|
||||
|
||||
var etaSeconds float64 = math.MaxFloat64
|
||||
var etaDuration = time.Duration(math.MaxInt64)
|
||||
var etaDuration = time.Duration(math.MinInt64)
|
||||
if progressPct >= 100.0 {
|
||||
etaDuration = 0
|
||||
} else if progressPct >= 0.1 {
|
||||
@ -957,7 +957,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) {
|
||||
switch etaDuration {
|
||||
case 0:
|
||||
eta = "due"
|
||||
case time.Duration(math.MaxInt64):
|
||||
case time.Duration(math.MinInt64):
|
||||
eta = "N/A"
|
||||
default:
|
||||
eta = base.PrettifyDurationOutput(etaDuration)
|
||||
|
Loading…
Reference in New Issue
Block a user