Skip to content

Commit

Permalink
Do not show sync errors longer than 7 days ago.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Jul 26, 2023
1 parent ae20485 commit 0dc001e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/tableprinters/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ func (t *TablePrinter) SwitchTable(data []*models.V1SwitchResponse, wide bool) (

if s.LastSyncError != nil {
errorTime := time.Time(*s.LastSyncError.Time)
syncError = fmt.Sprintf("%s ago: %s", humanizeDuration(time.Since(errorTime)), s.LastSyncError.Error)
// after 7 days we do not show sync errors anymore
if !errorTime.IsZero() && time.Since(errorTime) < 7*24*time.Hour {
syncError = fmt.Sprintf("%s ago: %s", humanizeDuration(time.Since(errorTime)), s.LastSyncError.Error)
}
}

var mode string
Expand Down

0 comments on commit 0dc001e

Please sign in to comment.