heal: Do not show heal ETA when there is a retry attempt (#5025)
There is no suitable mechanism to estimate the ETA of healing when it is retrying, although in most cases, it is just a listing that should be quick enough. Hide the ETA anyway for now.
This commit is contained in:
+21
-11
@@ -399,11 +399,15 @@ func (s verboseBackgroundHealStatusMessage) String() string {
|
||||
}
|
||||
fmt.Fprintf(&msg, " + %s : %s\n", d.DrivePath, stateText)
|
||||
if d.Healing && d.HealInfo != nil && !d.HealInfo.Finished {
|
||||
now := time.Now().UTC()
|
||||
scanSpeed := float64(d.UsedSpace) / float64(now.Sub(d.HealInfo.Started))
|
||||
remainingTime := time.Duration(float64(setsStatus[setIndex{d.PoolIndex, d.SetIndex}].maxUsedSpace-d.UsedSpace) / scanSpeed)
|
||||
estimationText := humanize.RelTime(now, now.Add(remainingTime), "", "")
|
||||
fmt.Fprintf(&msg, " |__ Estimated: %s\n", estimationText)
|
||||
if d.HealInfo.RetryAttempts == 0 {
|
||||
now := time.Now().UTC()
|
||||
scanSpeed := float64(d.UsedSpace) / float64(now.Sub(d.HealInfo.Started))
|
||||
remainingTime := time.Duration(float64(setsStatus[setIndex{d.PoolIndex, d.SetIndex}].maxUsedSpace-d.UsedSpace) / scanSpeed)
|
||||
estimationText := humanize.RelTime(now, now.Add(remainingTime), "", "")
|
||||
fmt.Fprintf(&msg, " |__ Estimated: %s\n", estimationText)
|
||||
} else {
|
||||
fmt.Fprintf(&msg, " |__ Retry attempts: %d\n", d.HealInfo.RetryAttempts)
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(&msg, " |__ Capacity: %s/%s\n", humanize.IBytes(d.UsedSpace), humanize.IBytes(d.TotalSpace))
|
||||
if showTolerance {
|
||||
@@ -508,10 +512,12 @@ func (s shortBackgroundHealStatusMessage) String() string {
|
||||
leastPct = 0
|
||||
}
|
||||
|
||||
scanSpeed := float64(disk.UsedSpace) / float64(time.Since(disk.HealInfo.Started))
|
||||
remainingTime := time.Duration(float64(setsStatus[diskSet].maxUsedSpace-disk.UsedSpace) / scanSpeed)
|
||||
if remainingTime > healingRemaining {
|
||||
healingRemaining = remainingTime
|
||||
if disk.HealInfo.RetryAttempts == 0 {
|
||||
scanSpeed := float64(disk.UsedSpace) / float64(time.Since(disk.HealInfo.Started))
|
||||
remainingTime := time.Duration(float64(setsStatus[diskSet].maxUsedSpace-disk.UsedSpace) / scanSpeed)
|
||||
if remainingTime > healingRemaining {
|
||||
healingRemaining = remainingTime
|
||||
}
|
||||
}
|
||||
|
||||
disk := disk
|
||||
@@ -577,8 +583,12 @@ func (s shortBackgroundHealStatusMessage) String() string {
|
||||
}
|
||||
|
||||
// Estimation completion
|
||||
now := time.Now()
|
||||
healPrettyMsg += fmt.Sprintf("Estimated Completion: %s\n", humanize.RelTime(now, now.Add(healingRemaining), "", ""))
|
||||
eta := "<unknown>"
|
||||
if healingRemaining > 0 {
|
||||
now := time.Now()
|
||||
eta = humanize.RelTime(now, now.Add(healingRemaining), "", "")
|
||||
}
|
||||
healPrettyMsg += fmt.Sprintf("Estimated Completion: %s\n", eta)
|
||||
|
||||
if problematicDisks > 0 {
|
||||
healPrettyMsg += "\n"
|
||||
|
||||
@@ -21,7 +21,7 @@ require (
|
||||
github.com/minio/cli v1.24.2
|
||||
github.com/minio/colorjson v1.0.8
|
||||
github.com/minio/filepath v1.0.0
|
||||
github.com/minio/madmin-go/v3 v3.0.63
|
||||
github.com/minio/madmin-go/v3 v3.0.64-0.20240822003756-fe52a32e526d
|
||||
github.com/minio/minio-go/v7 v7.0.75
|
||||
github.com/minio/pkg/v3 v3.0.11
|
||||
github.com/minio/selfupdate v0.6.0
|
||||
|
||||
@@ -138,6 +138,8 @@ github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY=
|
||||
github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw=
|
||||
github.com/minio/madmin-go/v3 v3.0.63 h1:ERJRxEI/FFRh8MDi4Z+3DKe4sONkQ0g+OkNzRpk7qxk=
|
||||
github.com/minio/madmin-go/v3 v3.0.63/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw=
|
||||
github.com/minio/madmin-go/v3 v3.0.64-0.20240822003756-fe52a32e526d h1:ma9PAmbEs+TP9BdsbQLO3gUa2nHSzeuQobOCT8BWUpg=
|
||||
github.com/minio/madmin-go/v3 v3.0.64-0.20240822003756-fe52a32e526d/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw=
|
||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||
github.com/minio/minio-go/v7 v7.0.75 h1:0uLrB6u6teY2Jt+cJUVi9cTvDRuBKWSRzSAcznRkwlE=
|
||||
|
||||
Reference in New Issue
Block a user