2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-10-22 09:56:12 +08:00

Update RDB.ForwardIfReady to forward to group if groupKey is specified

This commit is contained in:
Ken Hibino
2022-03-06 05:45:33 -08:00
parent a88f6498af
commit 17e9725287
3 changed files with 195 additions and 19 deletions

View File

@@ -205,9 +205,14 @@ func UniqueKey(qname, tasktype string, payload []byte) string {
return fmt.Sprintf("%sunique:%s:%s", QueueKeyPrefix(qname), tasktype, hex.EncodeToString(checksum[:]))
}
// GroupKeyPrefix returns a prefix for group key.
func GroupKeyPrefix(qname string) string {
return fmt.Sprintf("%sg:", QueueKeyPrefix(qname))
}
// GroupKey returns a redis key used to group tasks belong in the same group.
func GroupKey(qname, gkey string) string {
return fmt.Sprintf("%sg:%s", QueueKeyPrefix(qname), gkey)
return fmt.Sprintf("%s%s", GroupKeyPrefix(qname), gkey)
}
// AllGroups return a redis key used to store all group keys used in a given queue.