Fix index out of range when reading snapshots list
This commit is contained in:
parent
390074e048
commit
d049228980
2
job.go
2
job.go
@ -280,9 +280,11 @@ func (j Job) Run() {
|
||||
result.LastError = err
|
||||
} else {
|
||||
Metrics.SnapshotCurrentCount.WithLabelValues(j.Name).Set(float64(len(snapshots)))
|
||||
if len(snapshots) > 0 {
|
||||
latestSnapshot := snapshots[len(snapshots)-1]
|
||||
Metrics.SnapshotLatestTime.WithLabelValues(j.Name).Set(float64(latestSnapshot.Time.Unix()))
|
||||
}
|
||||
}
|
||||
|
||||
if result.Success {
|
||||
Metrics.JobFailureCount.WithLabelValues(j.Name).Set(0.0)
|
||||
|
Loading…
Reference in New Issue
Block a user