2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-08-19 15:08:55 +08:00

Rename InProgress to Active

This commit is contained in:
Ken Hibino
2020-09-05 12:43:15 -07:00
parent ebe3c4083f
commit a891ce5568
17 changed files with 304 additions and 305 deletions

View File

@@ -40,10 +40,9 @@ func QueueKey(qname string) string {
return fmt.Sprintf("asynq:{%s}", qname)
}
// TODO: Should we rename this to "active"?
// InProgressKey returns a redis key for the in-progress tasks.
func InProgressKey(qname string) string {
return fmt.Sprintf("asynq:{%s}:in_progress", qname)
// ActiveKey returns a redis key for the active tasks.
func ActiveKey(qname string) string {
return fmt.Sprintf("asynq:{%s}:active", qname)
}
// ScheduledKey returns a redis key for the scheduled tasks.
@@ -274,7 +273,7 @@ type WorkerInfo struct {
Started time.Time
}
// Cancelations is a collection that holds cancel functions for all in-progress tasks.
// Cancelations is a collection that holds cancel functions for all active tasks.
//
// Cancelations are safe for concurrent use by multipel goroutines.
type Cancelations struct {

View File

@@ -32,19 +32,19 @@ func TestQueueKey(t *testing.T) {
}
}
func TestInProgressKey(t *testing.T) {
func TestActiveKey(t *testing.T) {
tests := []struct {
qname string
want string
}{
{"default", "asynq:{default}:in_progress"},
{"custom", "asynq:{custom}:in_progress"},
{"default", "asynq:{default}:active"},
{"custom", "asynq:{custom}:active"},
}
for _, tc := range tests {
got := InProgressKey(tc.qname)
got := ActiveKey(tc.qname)
if got != tc.want {
t.Errorf("InProgressKey(%q) = %q, want %q", tc.qname, got, tc.want)
t.Errorf("ActiveKey(%q) = %q, want %q", tc.qname, got, tc.want)
}
}
}