Skip to content

Commit

Permalink
enhc: added docs for StartReaper and time.Duration param
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfolkins committed Jan 21, 2015
1 parent 511b36b commit d376319
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ func main() {
}

// Start the reaper
st.StartReaper()
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

// router
router := httprouter.New()
Expand Down
6 changes: 1 addition & 5 deletions studio.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ import (
"time"
)

const (
minutes = 60
)

// Studio is the singleton instance, it contains the Directors(buckets) who have many Actors(points)
type Studio struct {
sync.Mutex
Expand Down Expand Up @@ -111,7 +107,7 @@ func (st *Studio) IsJailed(an string) bool {
return d.lIsJailed(an)
}

// StartReaper starts the reaping goroutine
// StartReaper starts the reaping goroutine and takes a time.Duraction on how often you want the Reaper to run
func (st *Studio) StartReaper(dur time.Duration) {
ticker := time.NewTicker(dur)
go func() {
Expand Down
12 changes: 6 additions & 6 deletions studio_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func BenchmarkStudioInfraction512(b *testing.B) {
log.Fatal(err)
}

dur := time.Minute * time.Duration(minutes)
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

for i := 0; i < b.N; i++ {
Expand Down Expand Up @@ -55,7 +55,7 @@ func BenchmarkStudioInfraction1024(b *testing.B) {
log.Fatal(err)
}

dur := time.Minute * time.Duration(minutes)
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

for i := 0; i < b.N; i++ {
Expand Down Expand Up @@ -83,7 +83,7 @@ func BenchmarkStudioInfraction2048(b *testing.B) {
log.Fatal(err)
}

dur := time.Minute * time.Duration(minutes)
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

for i := 0; i < b.N; i++ {
Expand Down Expand Up @@ -111,7 +111,7 @@ func BenchmarkStudioInfraction4096(b *testing.B) {
log.Fatal(err)
}

dur := time.Minute * time.Duration(minutes)
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

for i := 0; i < b.N; i++ {
Expand Down Expand Up @@ -139,7 +139,7 @@ func BenchmarkStudioInfraction65536(b *testing.B) {
log.Fatal(err)
}

dur := time.Minute * time.Duration(minutes)
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

for i := 0; i < b.N; i++ {
Expand Down Expand Up @@ -167,7 +167,7 @@ func BenchmarkStudioInfraction262144(b *testing.B) {
log.Fatal(err)
}

dur := time.Minute * time.Duration(minutes)
dur := time.Minute * time.Duration(60)
st.StartReaper(dur)

for i := 0; i < b.N; i++ {
Expand Down

0 comments on commit d376319

Please sign in to comment.