2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-04-23 01:00:17 +08:00

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

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.13
require (
github.com/go-redis/redis/v7 v7.4.0
github.com/google/go-cmp v0.4.0
github.com/google/uuid v1.1.1
github.com/google/uuid v1.2.0
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/cast v1.3.1
go.uber.org/goleak v0.10.0

2
go.sum
View File

@ -13,6 +13,8 @@ github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=

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)},