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