Rename pending key

This commit is contained in:
Ken Hibino
2021-02-21 05:24:04 -08:00
parent 6a9d9fd717
commit fae6c4bdc8
9 changed files with 46 additions and 46 deletions

View File

@@ -25,7 +25,7 @@ const Version = "0.16.0"
const DefaultQueueName = "default"
// DefaultQueue is the redis key for the default queue.
var DefaultQueue = QueueKey(DefaultQueueName)
var DefaultQueue = PendingKey(DefaultQueueName)
// Global Redis keys.
const (
@@ -45,9 +45,9 @@ func ValidateQueueName(qname string) error {
return nil
}
// QueueKey returns a redis key for the given queue name.
func QueueKey(qname string) string {
return fmt.Sprintf("asynq:{%s}", qname)
// PendingKey returns a redis key for the given queue name.
func PendingKey(qname string) string {
return fmt.Sprintf("asynq:{%s}:pending", qname)
}
// ActiveKey returns a redis key for the active tasks.

View File

@@ -25,7 +25,7 @@ func TestQueueKey(t *testing.T) {
}
for _, tc := range tests {
got := QueueKey(tc.qname)
got := PendingKey(tc.qname)
if got != tc.want {
t.Errorf("QueueKey(%q) = %q, want %q", tc.qname, got, tc.want)
}