Update TaskKey helper to task id as string

This commit is contained in:
Ken Hibino
2021-02-21 06:14:59 -08:00
parent 0b043318ba
commit 16d8fa4b91
4 changed files with 6 additions and 4 deletions

View File

@@ -46,7 +46,7 @@ func ValidateQueueName(qname string) error {
}
// TaskKey returns a redis key for the given task message.
func TaskKey(qname string, id uuid.UUID) string {
func TaskKey(qname, id string) string {
return fmt.Sprintf("asynq:{%s}:t:%s", qname, id)
}

View File

@@ -17,11 +17,11 @@ import (
)
func TestTaskKey(t *testing.T) {
id := uuid.New()
id := uuid.NewString()
tests := []struct {
qname string
id uuid.UUID
id string
want string
}{
{"default", id, fmt.Sprintf("asynq:{default}:t:%s", id)},