Skip to content

Commit

Permalink
les: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 committed Oct 31, 2019
1 parent 2351fdf commit e7daae4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions les/balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ func TestEstimatedPriority(t *testing.T) {

// 3 seconds time cost, 3 second estimated time cost, 10^9*2 request cost,
// 4*10^9 estimated request cost.
{time.Second, 3*time.Second, 1000000000, ^int64(48)},
{time.Second, 3 * time.Second, 1000000000, ^int64(48)},

// All positive balance is used up
{time.Second*55, 0, 0, 0},
{time.Second * 55, 0, 0, 0},

// 1 minute estimated time cost, 4/58 * 10^9 estimated request cost per sec.
{0, time.Minute, 0, int64(time.Minute) + int64(time.Second) * 120/29},
{0, time.Minute, 0, int64(time.Minute) + int64(time.Second)*120/29},
}
for _, i := range inputs {
clock.Run(i.runTime)
Expand All @@ -209,13 +209,13 @@ func TestCallbackChecking(t *testing.T) {
tracker.setFactors(false, 1, 1)
tracker.setFactors(true, 1, 1)

var inputs = []struct{
var inputs = []struct {
priority int64
expDiff time.Duration
} {
{^int64(500), time.Millisecond*500},
}{
{^int64(500), time.Millisecond * 500},
{0, time.Second},
{int64(time.Second), 2*time.Second},
{int64(time.Second), 2 * time.Second},
}
tracker.setBalance(uint64(time.Second), 0)
for _, i := range inputs {
Expand All @@ -238,7 +238,7 @@ func TestCallback(t *testing.T) {

callCh := make(chan struct{}, 1)
tracker.setBalance(uint64(time.Minute), 0)
tracker.addCallback(balanceCallbackZero, 0, func() {callCh <- struct{}{}})
tracker.addCallback(balanceCallbackZero, 0, func() { callCh <- struct{}{} })

clock.Run(time.Minute)
select {
Expand All @@ -248,13 +248,13 @@ func TestCallback(t *testing.T) {
}

tracker.setBalance(uint64(time.Minute), 0)
tracker.addCallback(balanceCallbackZero, 0, func() {callCh <- struct{}{}})
tracker.addCallback(balanceCallbackZero, 0, func() { callCh <- struct{}{} })
tracker.removeCallback(balanceCallbackZero)

clock.Run(time.Minute)
select {
case <-callCh:
t.Fatalf("Callback shouldn't be called")
case <-time.NewTimer(time.Millisecond*100).C:
case <-time.NewTimer(time.Millisecond * 100).C:
}
}
2 changes: 1 addition & 1 deletion les/clientpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const (
// accepting and instantly kicking out clients. In theory, we try to ensure that
// each client can have several minutes of connection time.
//
// Balances of disconnected clients are stored in nodeDB including postive balance
// Balances of disconnected clients are stored in nodeDB including positive balance
// and negative banalce. Negative balance is transformed into a logarithmic form
// with a constantly shifting linear offset in order to implement an exponential
// decrease. Besides nodeDB will have a background thread to check the negative
Expand Down

0 comments on commit e7daae4

Please sign in to comment.