Compare commits

..

No commits in common. "5d5af6e9268c5f63eeffae2df2e86bf8f9b9728e" and "b0b8ac2d5b3b83a264b0ecc6d5be85c13d7cd8f5" have entirely different histories.

6 changed files with 14 additions and 15 deletions

View File

@ -3,18 +3,9 @@ kind: pipeline
name: default
steps:
- name: gosec security analysis
image: securego/gosec
commands:
- gosec ./...
- name: staticcheck analysis
image: golang
commands:
- go install honnef.co/go/tools/cmd/staticcheck
- "$(go env GOPATH)/bin/staticcheck"
- name: build, test and benchmark
image: golang
commands:
- go build -race
- go test
- go test -bench=.
- go build

1
go.sum
View File

@ -1,4 +1,3 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/eapache/queue.v1 v1.1.0 h1:EldqoJEGtXYiVCMRo2C9mePO2UUGnYn2+qLmlQSqPdc=
gopkg.in/eapache/queue.v1 v1.1.0/go.mod h1:wNtmx1/O7kZSR9zNT1TTOJ7GLpm3Vn7srzlfylFbQwU=

View File

@ -4,13 +4,16 @@ import (
"runtime"
"sync"
"testing"
"time"
)
var testQ = NewQueue()
func testAdd(n int) {
for i := 0; i < n; i++ {
testQ.Add(func() {})
testQ.Add(func() {
time.Sleep(1)
})
}
}

View File

@ -33,7 +33,10 @@ func SimpleScheduler(tq *TaskQueue) bool {
queued++
}
}
return (queued > 0)
if queued > 0 {
return true
}
return false
}
// TimeSliceScheduler attempts to give tasks a fair share of the Stats()

View File

@ -74,7 +74,7 @@ func (s *Stat) Start() (start time.Time) {
// This will fluctuate between 90-100% of the window size set when the state
// was created, as internal buckets roll over.
func (s *Stat) Duration() time.Duration {
return time.Since(s.Start())
return time.Now().Sub(s.Start())
}
// Rate returns the flow rate of this counter, which is the current rolling

View File

@ -11,7 +11,10 @@ func (list UIntSlice) Len() int {
// Less helps fulfill sort.Interface.
func (list UIntSlice) Less(i, j int) bool {
return list[i] <= list[j]
if list[i] <= list[j] {
return true
}
return false
}
// Swap helps fulfill sort.Interface