Skip to content

Commit 2e89d10

Browse files
committed
Merge pull request bitly#3 from benmanns/gofmt
Run gofmt
2 parents fed86fa + ee3c711 commit 2e89d10

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

epsilon_greedy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ type epsilonGreedyHostPool struct {
3030

3131
// Construct an Epsilon Greedy HostPool
3232
//
33-
// Epsilon Greedy is an algorithm that allows HostPool not only to track failure state,
33+
// Epsilon Greedy is an algorithm that allows HostPool not only to track failure state,
3434
// but also to learn about "better" options in terms of speed, and to pick from available hosts
3535
// based on how well they perform. This gives a weighted request rate to better
3636
// performing hosts, while still distributing requests to all hosts (proportionate to their performance).
3737
// The interface is the same as the standard HostPool, but be sure to mark the HostResponse immediately
3838
// after executing the request to the host, as that will stop the implicitly running request timer.
39-
//
39+
//
4040
// A good overview of Epsilon Greedy is here http://stevehanov.ca/blog/index.php?id=132
4141
//
4242
// To compute the weighting scores, we perform a weighted average of recent response times, over the course of
@@ -53,7 +53,7 @@ func NewEpsilonGreedy(hosts []string, decayDuration time.Duration, calc EpsilonV
5353
epsilon: float32(initialEpsilon),
5454
decayDuration: decayDuration,
5555
EpsilonValueCalculator: calc,
56-
timer: &realTimer{},
56+
timer: &realTimer{},
5757
}
5858

5959
// allocate structures

hostpool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (p *standardHostPool) markFailed(hostR HostPoolResponse) {
185185
}
186186
func (p *standardHostPool) Hosts() []string {
187187
hosts := make([]string, len(p.hosts))
188-
for host, _ := range p.hosts {
188+
for host := range p.hosts {
189189
hosts = append(hosts, host)
190190
}
191191
return hosts

hostpool_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestEpsilonGreedy(t *testing.T) {
8989
hostR.Mark(nil)
9090
}
9191

92-
for host, _ := range hitCounts {
92+
for host := range hitCounts {
9393
log.Printf("host %s hit %d times (%0.2f percent)", host, hitCounts[host], (float64(hitCounts[host])/float64(iterations))*100.0)
9494
}
9595

@@ -113,7 +113,7 @@ func TestEpsilonGreedy(t *testing.T) {
113113
hostR.Mark(nil)
114114
}
115115

116-
for host, _ := range hitCounts {
116+
for host := range hitCounts {
117117
log.Printf("host %s hit %d times (%0.2f percent)", host, hitCounts[host], (float64(hitCounts[host])/float64(iterations))*100.0)
118118
}
119119

0 commit comments

Comments
 (0)