Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

type config struct {
processId string
ProcessId string
Namespace string
PollInterval int
Pool *redis.Pool
Expand Down Expand Up @@ -73,8 +73,10 @@ func Configure(options map[string]string) {
return err
},
},
func(queue string) Fetcher {
return NewFetch(queue, make(chan *Msg), make(chan bool))
},
DefaultFetch,
}
}

func DefaultFetch(queue string) Fetcher {
return NewFetch(queue, make(chan *Msg), make(chan bool))
}
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ func ConfigSpec(c gospec.Context) {
})

c.Specify("can specify custom process", func() {
c.Expect(Config.processId, Equals, "1")
c.Expect(Config.ProcessId, Equals, "1")

Configure(map[string]string{
"server": "localhost:6379",
"process": "2",
})

c.Expect(Config.processId, Equals, "2")
c.Expect(Config.ProcessId, Equals, "2")
})

c.Specify("requires a server parameter", func() {
Expand Down
2 changes: 1 addition & 1 deletion fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@ func (f *fetch) inprogressMessages() []string {
}

func (f *fetch) inprogressQueue() string {
return fmt.Sprint(f.queue, ":", Config.processId, ":inprogress")
return fmt.Sprint(f.queue, ":", Config.ProcessId, ":inprogress")
}
7 changes: 5 additions & 2 deletions manager_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package workers

import (
"fmt"
"reflect"
"runtime"
"sync"
"time"

Expand Down Expand Up @@ -54,7 +55,9 @@ func ManagerSpec(c gospec.Context) {

c.Specify("sets job function", func() {
manager := newManager("myqueue", testJob, 10)
c.Expect(fmt.Sprint(manager.job), Equals, fmt.Sprint(testJob))
expected := runtime.FuncForPC(reflect.ValueOf(manager.job).Pointer()).Name()
actual := runtime.FuncForPC(reflect.ValueOf(testJob).Pointer()).Name()
c.Expect(expected, Equals, actual)
})

c.Specify("sets worker concurrency", func() {
Expand Down