Skip to content

Commit

Permalink
Merge pull request #14 from rb3ckers/fix-range-bug
Browse files Browse the repository at this point in the history
fix(targets): Fix range bug
  • Loading branch information
rb3ckers authored Jan 22, 2020
2 parents 7405f3d + 34a2d3b commit e276819
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions datatypes/MirrorTargets.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ func (mt *MirrorTargets) ForEach(f func(string, *gobreaker.CircuitBreaker)) {
}
}

func (mt *MirrorTargets) ListTargets() []Target {
targets := make([]Target, len(mt.targets)-1)

func (mt *MirrorTargets) ListTargets() []*Target {
targets := make([]*Target, len(mt.targets))
i := 0
for url, target := range mt.targets {
var state string
switch target.circuitBreaker.State() {
Expand All @@ -88,11 +88,12 @@ func (mt *MirrorTargets) ListTargets() []Target {
state = "unknown"
}

targets = append(targets, Target{
targets[i] = &Target{
Name: url,
FailingSince: target.firstFailure,
State: state,
})
}
i = i + 1
}
return targets
}
Expand Down

0 comments on commit e276819

Please sign in to comment.