2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-26 11:16:12 +08:00

Change Background API to take Handler interface

This commit is contained in:
Ken Hibino
2019-12-02 20:42:21 -08:00
parent 1a996e0d40
commit b0a54cd2b2
5 changed files with 34 additions and 13 deletions

View File

@@ -50,7 +50,8 @@ func TestProcessorSuccess(t *testing.T) {
// instantiate a new processor
var mu sync.Mutex
var processed []*Task
h := func(task *Task) error {
var h HandlerFunc
h = func(task *Task) error {
mu.Lock()
defer mu.Unlock()
processed = append(processed, task)
@@ -133,7 +134,8 @@ func TestProcessorRetry(t *testing.T) {
t.Fatal(err)
}
// instantiate a new processor
h := func(task *Task) error {
var h HandlerFunc
h = func(task *Task) error {
return fmt.Errorf(errMsg)
}
p := newProcessor(r, 10, h)
@@ -178,7 +180,7 @@ func TestProcessorRetry(t *testing.T) {
func TestPerform(t *testing.T) {
tests := []struct {
desc string
handler TaskHandler
handler HandlerFunc
task *Task
wantErr bool
}{