mirror of
https://github.com/hibiken/asynq.git
synced 2025-04-20 15:50:20 +08:00
Merge def6f5d149029c2b945a2c025ba122f3a6a482f4 into 2165ed133bcb1e5bc0057d2e1d9d583369ab73fc
This commit is contained in:
commit
4767dcf8fa
21
asynq.go
21
asynq.go
@ -12,10 +12,11 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Task represents a unit of work to be performed.
|
// Task represents a unit of work to be performed.
|
||||||
@ -438,10 +439,11 @@ func (opt RedisClusterClientOpt) MakeRedisClient() interface{} {
|
|||||||
//
|
//
|
||||||
// Three URI schemes are supported, which are redis:, rediss:, redis-socket:, and redis-sentinel:.
|
// Three URI schemes are supported, which are redis:, rediss:, redis-socket:, and redis-sentinel:.
|
||||||
// Supported formats are:
|
// Supported formats are:
|
||||||
// redis://[:password@]host[:port][/dbnumber]
|
//
|
||||||
// rediss://[:password@]host[:port][/dbnumber]
|
// redis://[:password@]host[:port][/dbnumber]
|
||||||
// redis-socket://[:password@]path[?db=dbnumber]
|
// rediss://[:password@]host[:port][/dbnumber]
|
||||||
// redis-sentinel://[:password@]host1[:port][,host2:[:port]][,hostN:[:port]][?master=masterName]
|
// redis-socket://[:password@]path[?db=dbnumber]
|
||||||
|
// redis-sentinel://[:password@]host1[:port][,host2:[:port]][,hostN:[:port]][?master=masterName]
|
||||||
func ParseRedisURI(uri string) (RedisConnOpt, error) {
|
func ParseRedisURI(uri string) (RedisConnOpt, error) {
|
||||||
u, err := url.Parse(uri)
|
u, err := url.Parse(uri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -545,3 +547,12 @@ func (w *ResultWriter) Write(data []byte) (n int, err error) {
|
|||||||
func (w *ResultWriter) TaskID() string {
|
func (w *ResultWriter) TaskID() string {
|
||||||
return w.id
|
return w.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var globalPrefixOnce sync.Once
|
||||||
|
|
||||||
|
// SetGlobalPrefix sets the global prefix for all redis keys used by asynq.
|
||||||
|
func SetGlobalPrefix(prefix string) {
|
||||||
|
globalPrefixOnce.Do(func() {
|
||||||
|
base.GlobalPrefix = prefix
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -11,11 +11,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/google/go-cmp/cmp/cmpopts"
|
"github.com/google/go-cmp/cmp/cmpopts"
|
||||||
"github.com/hibiken/asynq/internal/log"
|
"github.com/hibiken/asynq/internal/log"
|
||||||
h "github.com/hibiken/asynq/internal/testutil"
|
h "github.com/hibiken/asynq/internal/testutil"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/errors"
|
"github.com/hibiken/asynq/internal/errors"
|
||||||
"github.com/hibiken/asynq/internal/rdb"
|
"github.com/hibiken/asynq/internal/rdb"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Client is responsible for scheduling tasks.
|
// A Client is responsible for scheduling tasks.
|
||||||
@ -150,9 +150,9 @@ func (t deadlineOption) Value() interface{} { return time.Time(t) }
|
|||||||
// TTL duration must be greater than or equal to 1 second.
|
// TTL duration must be greater than or equal to 1 second.
|
||||||
//
|
//
|
||||||
// Uniqueness of a task is based on the following properties:
|
// Uniqueness of a task is based on the following properties:
|
||||||
// - Task Type
|
// - Task Type
|
||||||
// - Task Payload
|
// - Task Payload
|
||||||
// - Queue Name
|
// - Queue Name
|
||||||
func Unique(ttl time.Duration) Option {
|
func Unique(ttl time.Duration) Option {
|
||||||
return uniqueOption(ttl)
|
return uniqueOption(ttl)
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/errors"
|
"github.com/hibiken/asynq/internal/errors"
|
||||||
"github.com/hibiken/asynq/internal/rdb"
|
"github.com/hibiken/asynq/internal/rdb"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Inspector is a client interface to inspect and mutate the state of
|
// Inspector is a client interface to inspect and mutate the state of
|
||||||
|
@ -39,7 +39,7 @@ func TestInspectorQueues(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r)
|
h.FlushDB(t, r)
|
||||||
for _, qname := range tc.queues {
|
for _, qname := range tc.queues {
|
||||||
if err := r.SAdd(context.Background(), base.AllQueues, qname).Err(); err != nil {
|
if err := r.SAdd(context.Background(), base.AllQueues(), qname).Err(); err != nil {
|
||||||
t.Fatalf("could not initialize all queue set: %v", err)
|
t.Fatalf("could not initialize all queue set: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,8 +138,8 @@ func TestInspectorDeleteQueue(t *testing.T) {
|
|||||||
tc.qname, tc.force, err)
|
tc.qname, tc.force, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if r.SIsMember(context.Background(), base.AllQueues, tc.qname).Val() {
|
if r.SIsMember(context.Background(), base.AllQueues(), tc.qname).Val() {
|
||||||
t.Errorf("%q is a member of %q", tc.qname, base.AllQueues)
|
t.Errorf("%q is a member of %q", tc.qname, base.AllQueues())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -429,7 +429,7 @@ func TestInspectorHistory(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r)
|
h.FlushDB(t, r)
|
||||||
|
|
||||||
r.SAdd(context.Background(), base.AllQueues, tc.qname)
|
r.SAdd(context.Background(), base.AllQueues(), tc.qname)
|
||||||
// populate last n days data
|
// populate last n days data
|
||||||
for i := 0; i < tc.n; i++ {
|
for i := 0; i < tc.n; i++ {
|
||||||
ts := now.Add(-time.Duration(i) * 24 * time.Hour)
|
ts := now.Add(-time.Duration(i) * 24 * time.Hour)
|
||||||
@ -1196,7 +1196,7 @@ func TestInspectorListAggregatingTasks(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r)
|
h.FlushDB(t, r)
|
||||||
h.SeedTasks(t, r, fxt.tasks)
|
h.SeedTasks(t, r, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r, fxt.allGroups)
|
h.SeedRedisSets(t, r, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r, fxt.groups)
|
h.SeedRedisZSets(t, r, fxt.groups)
|
||||||
|
|
||||||
|
@ -31,14 +31,28 @@ const DefaultQueueName = "default"
|
|||||||
// DefaultQueue is the redis key for the default queue.
|
// DefaultQueue is the redis key for the default queue.
|
||||||
var DefaultQueue = PendingKey(DefaultQueueName)
|
var DefaultQueue = PendingKey(DefaultQueueName)
|
||||||
|
|
||||||
// Global Redis keys.
|
// GlobalPrefix is the prefix for all redis keys used by asynq.
|
||||||
const (
|
var GlobalPrefix = "asynq"
|
||||||
AllServers = "asynq:servers" // ZSET
|
|
||||||
AllWorkers = "asynq:workers" // ZSET
|
func AllServers() string {
|
||||||
AllSchedulers = "asynq:schedulers" // ZSET
|
return fmt.Sprintf("%s:servers", GlobalPrefix) // ZSET
|
||||||
AllQueues = "asynq:queues" // SET
|
}
|
||||||
CancelChannel = "asynq:cancel" // PubSub channel
|
|
||||||
)
|
func AllWorkers() string {
|
||||||
|
return fmt.Sprintf("%s:workers", GlobalPrefix) // ZSET
|
||||||
|
}
|
||||||
|
|
||||||
|
func AllSchedulers() string {
|
||||||
|
return fmt.Sprintf("%s:schedulers", GlobalPrefix) // ZSET
|
||||||
|
}
|
||||||
|
|
||||||
|
func AllQueues() string {
|
||||||
|
return fmt.Sprintf("%s:queues", GlobalPrefix) // SET
|
||||||
|
}
|
||||||
|
|
||||||
|
func CancelChannel() string {
|
||||||
|
return fmt.Sprintf("%s:cancel", GlobalPrefix) // PubSub channel
|
||||||
|
}
|
||||||
|
|
||||||
// TaskState denotes the state of a task.
|
// TaskState denotes the state of a task.
|
||||||
type TaskState int
|
type TaskState int
|
||||||
@ -104,7 +118,7 @@ func ValidateQueueName(qname string) error {
|
|||||||
|
|
||||||
// QueueKeyPrefix returns a prefix for all keys in the given queue.
|
// QueueKeyPrefix returns a prefix for all keys in the given queue.
|
||||||
func QueueKeyPrefix(qname string) string {
|
func QueueKeyPrefix(qname string) string {
|
||||||
return fmt.Sprintf("asynq:{%s}:", qname)
|
return fmt.Sprintf("%s:{%s}:", GlobalPrefix, qname)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TaskKeyPrefix returns a prefix for task key.
|
// TaskKeyPrefix returns a prefix for task key.
|
||||||
@ -178,22 +192,22 @@ func FailedKey(qname string, t time.Time) string {
|
|||||||
|
|
||||||
// ServerInfoKey returns a redis key for process info.
|
// ServerInfoKey returns a redis key for process info.
|
||||||
func ServerInfoKey(hostname string, pid int, serverID string) string {
|
func ServerInfoKey(hostname string, pid int, serverID string) string {
|
||||||
return fmt.Sprintf("asynq:servers:{%s:%d:%s}", hostname, pid, serverID)
|
return fmt.Sprintf("%s:servers:{%s:%d:%s}", GlobalPrefix, hostname, pid, serverID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WorkersKey returns a redis key for the workers given hostname, pid, and server ID.
|
// WorkersKey returns a redis key for the workers given hostname, pid, and server ID.
|
||||||
func WorkersKey(hostname string, pid int, serverID string) string {
|
func WorkersKey(hostname string, pid int, serverID string) string {
|
||||||
return fmt.Sprintf("asynq:workers:{%s:%d:%s}", hostname, pid, serverID)
|
return fmt.Sprintf("%s:workers:{%s:%d:%s}", GlobalPrefix, hostname, pid, serverID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchedulerEntriesKey returns a redis key for the scheduler entries given scheduler ID.
|
// SchedulerEntriesKey returns a redis key for the scheduler entries given scheduler ID.
|
||||||
func SchedulerEntriesKey(schedulerID string) string {
|
func SchedulerEntriesKey(schedulerID string) string {
|
||||||
return fmt.Sprintf("asynq:schedulers:{%s}", schedulerID)
|
return fmt.Sprintf("%s:schedulers:{%s}", GlobalPrefix, schedulerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchedulerHistoryKey returns a redis key for the scheduler's history for the given entry.
|
// SchedulerHistoryKey returns a redis key for the scheduler's history for the given entry.
|
||||||
func SchedulerHistoryKey(entryID string) string {
|
func SchedulerHistoryKey(entryID string) string {
|
||||||
return fmt.Sprintf("asynq:scheduler_history:%s", entryID)
|
return fmt.Sprintf("%s:scheduler_history:%s", GlobalPrefix, entryID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UniqueKey returns a redis key with the given type, payload, and queue name.
|
// UniqueKey returns a redis key with the given type, payload, and queue name.
|
||||||
|
@ -10,15 +10,15 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/errors"
|
"github.com/hibiken/asynq/internal/errors"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AllQueues returns a list of all queue names.
|
// AllQueues returns a list of all queue names.
|
||||||
func (r *RDB) AllQueues() ([]string, error) {
|
func (r *RDB) AllQueues() ([]string, error) {
|
||||||
return r.client.SMembers(context.Background(), base.AllQueues).Result()
|
return r.client.SMembers(context.Background(), base.AllQueues()).Result()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stats represents a state of queues at a certain time.
|
// Stats represents a state of queues at a certain time.
|
||||||
@ -804,7 +804,7 @@ func (r *RDB) ListAggregating(qname, gname string, pgn Pagination) ([]*base.Task
|
|||||||
|
|
||||||
// Reports whether a queue with the given name exists.
|
// Reports whether a queue with the given name exists.
|
||||||
func (r *RDB) queueExists(qname string) (bool, error) {
|
func (r *RDB) queueExists(qname string) (bool, error) {
|
||||||
return r.client.SIsMember(context.Background(), base.AllQueues, qname).Result()
|
return r.client.SIsMember(context.Background(), base.AllQueues(), qname).Result()
|
||||||
}
|
}
|
||||||
|
|
||||||
// KEYS[1] -> key for ids set (e.g. asynq:{<qname>}:scheduled)
|
// KEYS[1] -> key for ids set (e.g. asynq:{<qname>}:scheduled)
|
||||||
@ -1829,7 +1829,7 @@ func (r *RDB) RemoveQueue(qname string, force bool) error {
|
|||||||
}
|
}
|
||||||
switch n {
|
switch n {
|
||||||
case 1:
|
case 1:
|
||||||
if err := r.client.SRem(context.Background(), base.AllQueues, qname).Err(); err != nil {
|
if err := r.client.SRem(context.Background(), base.AllQueues(), qname).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, err)
|
return errors.E(op, errors.Unknown, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -1852,7 +1852,7 @@ return keys`)
|
|||||||
// ListServers returns the list of server info.
|
// ListServers returns the list of server info.
|
||||||
func (r *RDB) ListServers() ([]*base.ServerInfo, error) {
|
func (r *RDB) ListServers() ([]*base.ServerInfo, error) {
|
||||||
now := r.clock.Now()
|
now := r.clock.Now()
|
||||||
res, err := listServerKeysCmd.Run(context.Background(), r.client, []string{base.AllServers}, now.Unix()).Result()
|
res, err := listServerKeysCmd.Run(context.Background(), r.client, []string{base.AllServers()}, now.Unix()).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1886,7 +1886,7 @@ return keys`)
|
|||||||
func (r *RDB) ListWorkers() ([]*base.WorkerInfo, error) {
|
func (r *RDB) ListWorkers() ([]*base.WorkerInfo, error) {
|
||||||
var op errors.Op = "rdb.ListWorkers"
|
var op errors.Op = "rdb.ListWorkers"
|
||||||
now := r.clock.Now()
|
now := r.clock.Now()
|
||||||
res, err := listWorkersCmd.Run(context.Background(), r.client, []string{base.AllWorkers}, now.Unix()).Result()
|
res, err := listWorkersCmd.Run(context.Background(), r.client, []string{base.AllWorkers()}, now.Unix()).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.E(op, errors.Unknown, err)
|
return nil, errors.E(op, errors.Unknown, err)
|
||||||
}
|
}
|
||||||
@ -1921,7 +1921,7 @@ return keys`)
|
|||||||
// ListSchedulerEntries returns the list of scheduler entries.
|
// ListSchedulerEntries returns the list of scheduler entries.
|
||||||
func (r *RDB) ListSchedulerEntries() ([]*base.SchedulerEntry, error) {
|
func (r *RDB) ListSchedulerEntries() ([]*base.SchedulerEntry, error) {
|
||||||
now := r.clock.Now()
|
now := r.clock.Now()
|
||||||
res, err := listSchedulerKeysCmd.Run(context.Background(), r.client, []string{base.AllSchedulers}, now.Unix()).Result()
|
res, err := listSchedulerKeysCmd.Run(context.Background(), r.client, []string{base.AllSchedulers()}, now.Unix()).Result()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func TestAllQueues(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
for _, qname := range tc.queues {
|
for _, qname := range tc.queues {
|
||||||
if err := r.client.SAdd(context.Background(), base.AllQueues, qname).Err(); err != nil {
|
if err := r.client.SAdd(context.Background(), base.AllQueues(), qname).Err(); err != nil {
|
||||||
t.Fatalf("could not initialize all queue set: %v", err)
|
t.Fatalf("could not initialize all queue set: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ func TestCurrentStats(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, tc.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), tc.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, tc.allGroups)
|
h.SeedRedisSets(t, r.client, tc.allGroups)
|
||||||
h.SeedTasks(t, r.client, tc.tasks)
|
h.SeedTasks(t, r.client, tc.tasks)
|
||||||
h.SeedRedisLists(t, r.client, tc.pending)
|
h.SeedRedisLists(t, r.client, tc.pending)
|
||||||
@ -357,7 +357,7 @@ func TestHistoricalStats(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
|
|
||||||
r.client.SAdd(context.Background(), base.AllQueues, tc.qname)
|
r.client.SAdd(context.Background(), base.AllQueues(), tc.qname)
|
||||||
// populate last n days data
|
// populate last n days data
|
||||||
for i := 0; i < tc.n; i++ {
|
for i := 0; i < tc.n; i++ {
|
||||||
ts := now.Add(-time.Duration(i) * 24 * time.Hour)
|
ts := now.Add(-time.Duration(i) * 24 * time.Hour)
|
||||||
@ -1637,7 +1637,7 @@ func TestListAggregating(t *testing.T) {
|
|||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
@ -1751,7 +1751,7 @@ func TestListAggregatingPagination(t *testing.T) {
|
|||||||
|
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
@ -2072,7 +2072,7 @@ func TestRunAggregatingTask(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
|
|
||||||
@ -2764,7 +2764,7 @@ func TestRunAllAggregatingTasks(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
|
|
||||||
@ -3077,7 +3077,7 @@ func TestArchiveAggregatingTask(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
|
|
||||||
@ -3564,7 +3564,7 @@ func TestArchiveAllAggregatingTasks(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
|
|
||||||
@ -4190,7 +4190,7 @@ func TestDeleteAggregatingTask(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
|
|
||||||
@ -4825,7 +4825,7 @@ func TestDeleteAllAggregatingTasks(t *testing.T) {
|
|||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
h.FlushDB(t, r.client)
|
h.FlushDB(t, r.client)
|
||||||
h.SeedTasks(t, r.client, fxt.tasks)
|
h.SeedTasks(t, r.client, fxt.tasks)
|
||||||
h.SeedRedisSet(t, r.client, base.AllQueues, fxt.allQueues)
|
h.SeedRedisSet(t, r.client, base.AllQueues(), fxt.allQueues)
|
||||||
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
h.SeedRedisSets(t, r.client, fxt.allGroups)
|
||||||
h.SeedRedisZSets(t, r.client, fxt.groups)
|
h.SeedRedisZSets(t, r.client, fxt.groups)
|
||||||
|
|
||||||
@ -5013,8 +5013,8 @@ func TestRemoveQueue(t *testing.T) {
|
|||||||
tc.qname, tc.force, err)
|
tc.qname, tc.force, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if r.client.SIsMember(context.Background(), base.AllQueues, tc.qname).Val() {
|
if r.client.SIsMember(context.Background(), base.AllQueues(), tc.qname).Val() {
|
||||||
t.Errorf("%q is a member of %q", tc.qname, base.AllQueues)
|
t.Errorf("%q is a member of %q", tc.qname, base.AllQueues())
|
||||||
}
|
}
|
||||||
|
|
||||||
keys := []string{
|
keys := []string{
|
||||||
|
@ -112,7 +112,7 @@ func (r *RDB) Enqueue(ctx context.Context, msg *base.TaskMessage) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
||||||
}
|
}
|
||||||
if err := r.client.SAdd(ctx, base.AllQueues, msg.Queue).Err(); err != nil {
|
if err := r.client.SAdd(ctx, base.AllQueues(), msg.Queue).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
keys := []string{
|
keys := []string{
|
||||||
@ -174,7 +174,7 @@ func (r *RDB) EnqueueUnique(ctx context.Context, msg *base.TaskMessage, ttl time
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Internal, "cannot encode task message: %v", err)
|
return errors.E(op, errors.Internal, "cannot encode task message: %v", err)
|
||||||
}
|
}
|
||||||
if err := r.client.SAdd(ctx, base.AllQueues, msg.Queue).Err(); err != nil {
|
if err := r.client.SAdd(ctx, base.AllQueues(), msg.Queue).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
keys := []string{
|
keys := []string{
|
||||||
@ -529,7 +529,7 @@ func (r *RDB) AddToGroup(ctx context.Context, msg *base.TaskMessage, groupKey st
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
||||||
}
|
}
|
||||||
if err := r.client.SAdd(ctx, base.AllQueues, msg.Queue).Err(); err != nil {
|
if err := r.client.SAdd(ctx, base.AllQueues(), msg.Queue).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
keys := []string{
|
keys := []string{
|
||||||
@ -591,7 +591,7 @@ func (r *RDB) AddToGroupUnique(ctx context.Context, msg *base.TaskMessage, group
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
||||||
}
|
}
|
||||||
if err := r.client.SAdd(ctx, base.AllQueues, msg.Queue).Err(); err != nil {
|
if err := r.client.SAdd(ctx, base.AllQueues(), msg.Queue).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
keys := []string{
|
keys := []string{
|
||||||
@ -648,7 +648,7 @@ func (r *RDB) Schedule(ctx context.Context, msg *base.TaskMessage, processAt tim
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
return errors.E(op, errors.Unknown, fmt.Sprintf("cannot encode message: %v", err))
|
||||||
}
|
}
|
||||||
if err := r.client.SAdd(ctx, base.AllQueues, msg.Queue).Err(); err != nil {
|
if err := r.client.SAdd(ctx, base.AllQueues(), msg.Queue).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
keys := []string{
|
keys := []string{
|
||||||
@ -707,7 +707,7 @@ func (r *RDB) ScheduleUnique(ctx context.Context, msg *base.TaskMessage, process
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Internal, fmt.Sprintf("cannot encode task message: %v", err))
|
return errors.E(op, errors.Internal, fmt.Sprintf("cannot encode task message: %v", err))
|
||||||
}
|
}
|
||||||
if err := r.client.SAdd(ctx, base.AllQueues, msg.Queue).Err(); err != nil {
|
if err := r.client.SAdd(ctx, base.AllQueues(), msg.Queue).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
keys := []string{
|
keys := []string{
|
||||||
@ -1367,10 +1367,10 @@ func (r *RDB) WriteServerState(info *base.ServerInfo, workers []*base.WorkerInfo
|
|||||||
}
|
}
|
||||||
skey := base.ServerInfoKey(info.Host, info.PID, info.ServerID)
|
skey := base.ServerInfoKey(info.Host, info.PID, info.ServerID)
|
||||||
wkey := base.WorkersKey(info.Host, info.PID, info.ServerID)
|
wkey := base.WorkersKey(info.Host, info.PID, info.ServerID)
|
||||||
if err := r.client.ZAdd(ctx, base.AllServers, redis.Z{Score: float64(exp.Unix()), Member: skey}).Err(); err != nil {
|
if err := r.client.ZAdd(ctx, base.AllServers(), redis.Z{Score: float64(exp.Unix()), Member: skey}).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
|
||||||
}
|
}
|
||||||
if err := r.client.ZAdd(ctx, base.AllWorkers, redis.Z{Score: float64(exp.Unix()), Member: wkey}).Err(); err != nil {
|
if err := r.client.ZAdd(ctx, base.AllWorkers(), redis.Z{Score: float64(exp.Unix()), Member: wkey}).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err})
|
||||||
}
|
}
|
||||||
return r.runScript(ctx, op, writeServerStateCmd, []string{skey, wkey}, args...)
|
return r.runScript(ctx, op, writeServerStateCmd, []string{skey, wkey}, args...)
|
||||||
@ -1389,10 +1389,10 @@ func (r *RDB) ClearServerState(host string, pid int, serverID string) error {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
skey := base.ServerInfoKey(host, pid, serverID)
|
skey := base.ServerInfoKey(host, pid, serverID)
|
||||||
wkey := base.WorkersKey(host, pid, serverID)
|
wkey := base.WorkersKey(host, pid, serverID)
|
||||||
if err := r.client.ZRem(ctx, base.AllServers, skey).Err(); err != nil {
|
if err := r.client.ZRem(ctx, base.AllServers(), skey).Err(); err != nil {
|
||||||
return errors.E(op, errors.Internal, &errors.RedisCommandError{Command: "zrem", Err: err})
|
return errors.E(op, errors.Internal, &errors.RedisCommandError{Command: "zrem", Err: err})
|
||||||
}
|
}
|
||||||
if err := r.client.ZRem(ctx, base.AllWorkers, wkey).Err(); err != nil {
|
if err := r.client.ZRem(ctx, base.AllWorkers(), wkey).Err(); err != nil {
|
||||||
return errors.E(op, errors.Internal, &errors.RedisCommandError{Command: "zrem", Err: err})
|
return errors.E(op, errors.Internal, &errors.RedisCommandError{Command: "zrem", Err: err})
|
||||||
}
|
}
|
||||||
return r.runScript(ctx, op, clearServerStateCmd, []string{skey, wkey})
|
return r.runScript(ctx, op, clearServerStateCmd, []string{skey, wkey})
|
||||||
@ -1423,7 +1423,7 @@ func (r *RDB) WriteSchedulerEntries(schedulerID string, entries []*base.Schedule
|
|||||||
}
|
}
|
||||||
exp := r.clock.Now().Add(ttl).UTC()
|
exp := r.clock.Now().Add(ttl).UTC()
|
||||||
key := base.SchedulerEntriesKey(schedulerID)
|
key := base.SchedulerEntriesKey(schedulerID)
|
||||||
err := r.client.ZAdd(ctx, base.AllSchedulers, redis.Z{Score: float64(exp.Unix()), Member: key}).Err()
|
err := r.client.ZAdd(ctx, base.AllSchedulers(), redis.Z{Score: float64(exp.Unix()), Member: key}).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err})
|
||||||
}
|
}
|
||||||
@ -1435,7 +1435,7 @@ func (r *RDB) ClearSchedulerEntries(scheduelrID string) error {
|
|||||||
var op errors.Op = "rdb.ClearSchedulerEntries"
|
var op errors.Op = "rdb.ClearSchedulerEntries"
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
key := base.SchedulerEntriesKey(scheduelrID)
|
key := base.SchedulerEntriesKey(scheduelrID)
|
||||||
if err := r.client.ZRem(ctx, base.AllSchedulers, key).Err(); err != nil {
|
if err := r.client.ZRem(ctx, base.AllSchedulers(), key).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zrem", Err: err})
|
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zrem", Err: err})
|
||||||
}
|
}
|
||||||
if err := r.client.Del(ctx, key).Err(); err != nil {
|
if err := r.client.Del(ctx, key).Err(); err != nil {
|
||||||
@ -1448,7 +1448,7 @@ func (r *RDB) ClearSchedulerEntries(scheduelrID string) error {
|
|||||||
func (r *RDB) CancelationPubSub() (*redis.PubSub, error) {
|
func (r *RDB) CancelationPubSub() (*redis.PubSub, error) {
|
||||||
var op errors.Op = "rdb.CancelationPubSub"
|
var op errors.Op = "rdb.CancelationPubSub"
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
pubsub := r.client.Subscribe(ctx, base.CancelChannel)
|
pubsub := r.client.Subscribe(ctx, base.CancelChannel())
|
||||||
_, err := pubsub.Receive(ctx)
|
_, err := pubsub.Receive(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.E(op, errors.Unknown, fmt.Sprintf("redis pubsub receive error: %v", err))
|
return nil, errors.E(op, errors.Unknown, fmt.Sprintf("redis pubsub receive error: %v", err))
|
||||||
@ -1461,7 +1461,7 @@ func (r *RDB) CancelationPubSub() (*redis.PubSub, error) {
|
|||||||
func (r *RDB) PublishCancelation(id string) error {
|
func (r *RDB) PublishCancelation(id string) error {
|
||||||
var op errors.Op = "rdb.PublishCancelation"
|
var op errors.Op = "rdb.PublishCancelation"
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
if err := r.client.Publish(ctx, base.CancelChannel, id).Err(); err != nil {
|
if err := r.client.Publish(ctx, base.CancelChannel(), id).Err(); err != nil {
|
||||||
return errors.E(op, errors.Unknown, fmt.Sprintf("redis pubsub publish error: %v", err))
|
return errors.E(op, errors.Unknown, fmt.Sprintf("redis pubsub publish error: %v", err))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -118,8 +118,8 @@ func TestEnqueue(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check queue is in the AllQueues set.
|
// Check queue is in the AllQueues set.
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,8 +199,8 @@ func TestEnqueueUnique(t *testing.T) {
|
|||||||
if diff := cmp.Diff(tc.msg, gotPending[0]); diff != "" {
|
if diff := cmp.Diff(tc.msg, gotPending[0]); diff != "" {
|
||||||
t.Errorf("persisted data differed from the original input (-want, +got)\n%s", diff)
|
t.Errorf("persisted data differed from the original input (-want, +got)\n%s", diff)
|
||||||
}
|
}
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Pending list has task ID.
|
// Check Pending list has task ID.
|
||||||
@ -236,8 +236,8 @@ func TestEnqueueUnique(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check queue is in the AllQueues set.
|
// Check queue is in the AllQueues set.
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enqueue the second message, should fail.
|
// Enqueue the second message, should fail.
|
||||||
@ -1228,8 +1228,8 @@ func TestAddToGroup(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check queue is in the AllQueues set.
|
// Check queue is in the AllQueues set.
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1338,8 +1338,8 @@ func TestAddToGroupUnique(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check queue is in the AllQueues set.
|
// Check queue is in the AllQueues set.
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
|
|
||||||
got := r.AddToGroupUnique(ctx, tc.msg, tc.groupKey, tc.ttl)
|
got := r.AddToGroupUnique(ctx, tc.msg, tc.groupKey, tc.ttl)
|
||||||
@ -1450,8 +1450,8 @@ func TestSchedule(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check queue is in the AllQueues set.
|
// Check queue is in the AllQueues set.
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1562,8 +1562,8 @@ func TestScheduleUnique(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check queue is in the AllQueues set.
|
// Check queue is in the AllQueues set.
|
||||||
if !r.client.SIsMember(context.Background(), base.AllQueues, tc.msg.Queue).Val() {
|
if !r.client.SIsMember(context.Background(), base.AllQueues(), tc.msg.Queue).Val() {
|
||||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enqueue the second message, should fail.
|
// Enqueue the second message, should fail.
|
||||||
@ -2794,10 +2794,10 @@ func TestWriteServerState(t *testing.T) {
|
|||||||
t.Errorf("TTL of %q was %v, want %v", skey, gotTTL, ttl)
|
t.Errorf("TTL of %q was %v, want %v", skey, gotTTL, ttl)
|
||||||
}
|
}
|
||||||
// Check ServerInfo key was added to the set all server keys correctly.
|
// Check ServerInfo key was added to the set all server keys correctly.
|
||||||
gotServerKeys := r.client.ZRange(context.Background(), base.AllServers, 0, -1).Val()
|
gotServerKeys := r.client.ZRange(context.Background(), base.AllServers(), 0, -1).Val()
|
||||||
wantServerKeys := []string{skey}
|
wantServerKeys := []string{skey}
|
||||||
if diff := cmp.Diff(wantServerKeys, gotServerKeys); diff != "" {
|
if diff := cmp.Diff(wantServerKeys, gotServerKeys); diff != "" {
|
||||||
t.Errorf("%q contained %v, want %v", base.AllServers, gotServerKeys, wantServerKeys)
|
t.Errorf("%q contained %v, want %v", base.AllServers(), gotServerKeys, wantServerKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check WorkersInfo was written correctly.
|
// Check WorkersInfo was written correctly.
|
||||||
@ -2807,10 +2807,10 @@ func TestWriteServerState(t *testing.T) {
|
|||||||
t.Errorf("%q key exists", wkey)
|
t.Errorf("%q key exists", wkey)
|
||||||
}
|
}
|
||||||
// Check WorkersInfo key was added to the set correctly.
|
// Check WorkersInfo key was added to the set correctly.
|
||||||
gotWorkerKeys := r.client.ZRange(context.Background(), base.AllWorkers, 0, -1).Val()
|
gotWorkerKeys := r.client.ZRange(context.Background(), base.AllWorkers(), 0, -1).Val()
|
||||||
wantWorkerKeys := []string{wkey}
|
wantWorkerKeys := []string{wkey}
|
||||||
if diff := cmp.Diff(wantWorkerKeys, gotWorkerKeys); diff != "" {
|
if diff := cmp.Diff(wantWorkerKeys, gotWorkerKeys); diff != "" {
|
||||||
t.Errorf("%q contained %v, want %v", base.AllWorkers, gotWorkerKeys, wantWorkerKeys)
|
t.Errorf("%q contained %v, want %v", base.AllWorkers(), gotWorkerKeys, wantWorkerKeys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2884,10 +2884,10 @@ func TestWriteServerStateWithWorkers(t *testing.T) {
|
|||||||
t.Errorf("TTL of %q was %v, want %v", skey, gotTTL, ttl)
|
t.Errorf("TTL of %q was %v, want %v", skey, gotTTL, ttl)
|
||||||
}
|
}
|
||||||
// Check ServerInfo key was added to the set correctly.
|
// Check ServerInfo key was added to the set correctly.
|
||||||
gotServerKeys := r.client.ZRange(context.Background(), base.AllServers, 0, -1).Val()
|
gotServerKeys := r.client.ZRange(context.Background(), base.AllServers(), 0, -1).Val()
|
||||||
wantServerKeys := []string{skey}
|
wantServerKeys := []string{skey}
|
||||||
if diff := cmp.Diff(wantServerKeys, gotServerKeys); diff != "" {
|
if diff := cmp.Diff(wantServerKeys, gotServerKeys); diff != "" {
|
||||||
t.Errorf("%q contained %v, want %v", base.AllServers, gotServerKeys, wantServerKeys)
|
t.Errorf("%q contained %v, want %v", base.AllServers(), gotServerKeys, wantServerKeys)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check WorkersInfo was written correctly.
|
// Check WorkersInfo was written correctly.
|
||||||
@ -2915,10 +2915,10 @@ func TestWriteServerStateWithWorkers(t *testing.T) {
|
|||||||
t.Errorf("TTL of %q was %v, want %v", wkey, gotTTL, ttl)
|
t.Errorf("TTL of %q was %v, want %v", wkey, gotTTL, ttl)
|
||||||
}
|
}
|
||||||
// Check WorkersInfo key was added to the set correctly.
|
// Check WorkersInfo key was added to the set correctly.
|
||||||
gotWorkerKeys := r.client.ZRange(context.Background(), base.AllWorkers, 0, -1).Val()
|
gotWorkerKeys := r.client.ZRange(context.Background(), base.AllWorkers(), 0, -1).Val()
|
||||||
wantWorkerKeys := []string{wkey}
|
wantWorkerKeys := []string{wkey}
|
||||||
if diff := cmp.Diff(wantWorkerKeys, gotWorkerKeys); diff != "" {
|
if diff := cmp.Diff(wantWorkerKeys, gotWorkerKeys); diff != "" {
|
||||||
t.Errorf("%q contained %v, want %v", base.AllWorkers, gotWorkerKeys, wantWorkerKeys)
|
t.Errorf("%q contained %v, want %v", base.AllWorkers(), gotWorkerKeys, wantWorkerKeys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3011,15 +3011,15 @@ func TestClearServerState(t *testing.T) {
|
|||||||
if r.client.Exists(context.Background(), wkey).Val() != 0 {
|
if r.client.Exists(context.Background(), wkey).Val() != 0 {
|
||||||
t.Errorf("Redis key %q exists", wkey)
|
t.Errorf("Redis key %q exists", wkey)
|
||||||
}
|
}
|
||||||
gotServerKeys := r.client.ZRange(context.Background(), base.AllServers, 0, -1).Val()
|
gotServerKeys := r.client.ZRange(context.Background(), base.AllServers(), 0, -1).Val()
|
||||||
wantServerKeys := []string{otherSKey}
|
wantServerKeys := []string{otherSKey}
|
||||||
if diff := cmp.Diff(wantServerKeys, gotServerKeys); diff != "" {
|
if diff := cmp.Diff(wantServerKeys, gotServerKeys); diff != "" {
|
||||||
t.Errorf("%q contained %v, want %v", base.AllServers, gotServerKeys, wantServerKeys)
|
t.Errorf("%q contained %v, want %v", base.AllServers(), gotServerKeys, wantServerKeys)
|
||||||
}
|
}
|
||||||
gotWorkerKeys := r.client.ZRange(context.Background(), base.AllWorkers, 0, -1).Val()
|
gotWorkerKeys := r.client.ZRange(context.Background(), base.AllWorkers(), 0, -1).Val()
|
||||||
wantWorkerKeys := []string{otherWKey}
|
wantWorkerKeys := []string{otherWKey}
|
||||||
if diff := cmp.Diff(wantWorkerKeys, gotWorkerKeys); diff != "" {
|
if diff := cmp.Diff(wantWorkerKeys, gotWorkerKeys); diff != "" {
|
||||||
t.Errorf("%q contained %v, want %v", base.AllWorkers, gotWorkerKeys, wantWorkerKeys)
|
t.Errorf("%q contained %v, want %v", base.AllWorkers(), gotWorkerKeys, wantWorkerKeys)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
var errRedisDown = errors.New("testutil: redis is down")
|
var errRedisDown = errors.New("testutil: redis is down")
|
||||||
|
@ -213,49 +213,49 @@ func FlushDB(tb testing.TB, r redis.UniversalClient) {
|
|||||||
// SeedPendingQueue initializes the specified queue with the given messages.
|
// SeedPendingQueue initializes the specified queue with the given messages.
|
||||||
func SeedPendingQueue(tb testing.TB, r redis.UniversalClient, msgs []*base.TaskMessage, qname string) {
|
func SeedPendingQueue(tb testing.TB, r redis.UniversalClient, msgs []*base.TaskMessage, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisList(tb, r, base.PendingKey(qname), msgs, base.TaskStatePending)
|
seedRedisList(tb, r, base.PendingKey(qname), msgs, base.TaskStatePending)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeedActiveQueue initializes the active queue with the given messages.
|
// SeedActiveQueue initializes the active queue with the given messages.
|
||||||
func SeedActiveQueue(tb testing.TB, r redis.UniversalClient, msgs []*base.TaskMessage, qname string) {
|
func SeedActiveQueue(tb testing.TB, r redis.UniversalClient, msgs []*base.TaskMessage, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisList(tb, r, base.ActiveKey(qname), msgs, base.TaskStateActive)
|
seedRedisList(tb, r, base.ActiveKey(qname), msgs, base.TaskStateActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeedScheduledQueue initializes the scheduled queue with the given messages.
|
// SeedScheduledQueue initializes the scheduled queue with the given messages.
|
||||||
func SeedScheduledQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
func SeedScheduledQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisZSet(tb, r, base.ScheduledKey(qname), entries, base.TaskStateScheduled)
|
seedRedisZSet(tb, r, base.ScheduledKey(qname), entries, base.TaskStateScheduled)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeedRetryQueue initializes the retry queue with the given messages.
|
// SeedRetryQueue initializes the retry queue with the given messages.
|
||||||
func SeedRetryQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
func SeedRetryQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisZSet(tb, r, base.RetryKey(qname), entries, base.TaskStateRetry)
|
seedRedisZSet(tb, r, base.RetryKey(qname), entries, base.TaskStateRetry)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeedArchivedQueue initializes the archived queue with the given messages.
|
// SeedArchivedQueue initializes the archived queue with the given messages.
|
||||||
func SeedArchivedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
func SeedArchivedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisZSet(tb, r, base.ArchivedKey(qname), entries, base.TaskStateArchived)
|
seedRedisZSet(tb, r, base.ArchivedKey(qname), entries, base.TaskStateArchived)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeedLease initializes the lease set with the given entries.
|
// SeedLease initializes the lease set with the given entries.
|
||||||
func SeedLease(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
func SeedLease(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisZSet(tb, r, base.LeaseKey(qname), entries, base.TaskStateActive)
|
seedRedisZSet(tb, r, base.LeaseKey(qname), entries, base.TaskStateActive)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SeedCompletedQueue initializes the completed set with the given entries.
|
// SeedCompletedQueue initializes the completed set with the given entries.
|
||||||
func SeedCompletedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
func SeedCompletedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisZSet(tb, r, base.CompletedKey(qname), entries, base.TaskStateCompleted)
|
seedRedisZSet(tb, r, base.CompletedKey(qname), entries, base.TaskStateCompleted)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,14 +263,14 @@ func SeedCompletedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z
|
|||||||
func SeedGroup(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname, gname string) {
|
func SeedGroup(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname, gname string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
r.SAdd(ctx, base.AllQueues, qname)
|
r.SAdd(ctx, base.AllQueues(), qname)
|
||||||
r.SAdd(ctx, base.AllGroups(qname), gname)
|
r.SAdd(ctx, base.AllGroups(qname), gname)
|
||||||
seedRedisZSet(tb, r, base.GroupKey(qname, gname), entries, base.TaskStateAggregating)
|
seedRedisZSet(tb, r, base.GroupKey(qname, gname), entries, base.TaskStateAggregating)
|
||||||
}
|
}
|
||||||
|
|
||||||
func SeedAggregationSet(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname, gname, setID string) {
|
func SeedAggregationSet(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname, gname, setID string) {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
r.SAdd(context.Background(), base.AllQueues, qname)
|
r.SAdd(context.Background(), base.AllQueues(), qname)
|
||||||
seedRedisZSet(tb, r, base.AggregationSetKey(qname, gname, setID), entries, base.TaskStateAggregating)
|
seedRedisZSet(tb, r, base.AggregationSetKey(qname, gname, setID), entries, base.TaskStateAggregating)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/log"
|
"github.com/hibiken/asynq/internal/log"
|
||||||
"github.com/hibiken/asynq/internal/rdb"
|
"github.com/hibiken/asynq/internal/rdb"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
"github.com/robfig/cron/v3"
|
"github.com/robfig/cron/v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/log"
|
"github.com/hibiken/asynq/internal/log"
|
||||||
"github.com/hibiken/asynq/internal/rdb"
|
"github.com/hibiken/asynq/internal/rdb"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is responsible for task processing and task lifecycle management.
|
// Server is responsible for task processing and task lifecycle management.
|
||||||
|
@ -8,9 +8,9 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
"github.com/hibiken/asynq/internal/log"
|
"github.com/hibiken/asynq/internal/log"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
)
|
)
|
||||||
|
|
||||||
type subscriber struct {
|
type subscriber struct {
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
|
||||||
"github.com/hibiken/asynq/tools/asynq/cmd/dash"
|
"github.com/hibiken/asynq/tools/asynq/cmd/dash"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell/v2"
|
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,9 +13,7 @@ import (
|
|||||||
"unicode"
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/gdamore/tcell/v2"
|
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
"github.com/mattn/go-runewidth"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -7,7 +7,6 @@ package dash
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
"github.com/gdamore/tcell/v2"
|
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell/v2"
|
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gdamore/tcell/v2"
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
"github.com/hibiken/asynq/internal/errors"
|
"github.com/hibiken/asynq/internal/errors"
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"unicode"
|
"unicode"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
"github.com/hibiken/asynq/internal/base"
|
"github.com/hibiken/asynq/internal/base"
|
||||||
@ -404,18 +403,22 @@ func getTLSConfig() *tls.Config {
|
|||||||
// cols is a list of headers and printRow specifies how to print rows.
|
// cols is a list of headers and printRow specifies how to print rows.
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
// type User struct {
|
//
|
||||||
// Name string
|
// type User struct {
|
||||||
// Addr string
|
// Name string
|
||||||
// Age int
|
// Addr string
|
||||||
// }
|
// Age int
|
||||||
|
// }
|
||||||
|
//
|
||||||
// data := []*User{{"user1", "addr1", 24}, {"user2", "addr2", 42}, ...}
|
// data := []*User{{"user1", "addr1", 24}, {"user2", "addr2", 42}, ...}
|
||||||
// cols := []string{"Name", "Addr", "Age"}
|
// cols := []string{"Name", "Addr", "Age"}
|
||||||
// printRows := func(w io.Writer, tmpl string) {
|
//
|
||||||
// for _, u := range data {
|
// printRows := func(w io.Writer, tmpl string) {
|
||||||
// fmt.Fprintf(w, tmpl, u.Name, u.Addr, u.Age)
|
// for _, u := range data {
|
||||||
// }
|
// fmt.Fprintf(w, tmpl, u.Name, u.Addr, u.Age)
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
// printTable(cols, printRows)
|
// printTable(cols, printRows)
|
||||||
func printTable(cols []string, printRows func(w io.Writer, tmpl string)) {
|
func printTable(cols []string, printRows func(w io.Writer, tmpl string)) {
|
||||||
format := strings.Repeat("%v\t", len(cols)) + "\n"
|
format := strings.Repeat("%v\t", len(cols)) + "\n"
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/hibiken/asynq/internal/rdb"
|
"github.com/hibiken/asynq/internal/rdb"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/MakeNowJust/heredoc/v2"
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/hibiken/asynq"
|
"github.com/hibiken/asynq"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
2
x/go.mod
2
x/go.mod
@ -5,6 +5,6 @@ go 1.16
|
|||||||
require (
|
require (
|
||||||
github.com/go-redis/redis/v8 v8.11.4
|
github.com/go-redis/redis/v8 v8.11.4
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/hibiken/asynq v0.21.0
|
|
||||||
github.com/prometheus/client_golang v1.11.0
|
github.com/prometheus/client_golang v1.11.0
|
||||||
|
github.com/hibiken/asynq v0.21.0
|
||||||
)
|
)
|
||||||
|
21
x/go.sum
21
x/go.sum
@ -66,8 +66,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
|
|||||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/hibiken/asynq v0.21.0 h1:uH9XogJhjq/S39E0/DEPWLZQ6hHJ73UiblZTe4RzHwA=
|
|
||||||
github.com/hibiken/asynq v0.21.0/go.mod h1:tyc63ojaW8SJ5SBm8mvI4DDONsguP5HE85EEl4Qr5Ig=
|
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||||
@ -126,6 +124,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
|
|||||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||||
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
|
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
|
||||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||||
|
github.com/hibiken/asynq v0.0.2 h1:6fsdyMzVd88R2jgxYeD7tV4I1ZweT8t4BmUJkQbOEag=
|
||||||
|
github.com/hibiken/asynq v0.0.2/go.mod h1:vCPM/7PjR9zRON0uSxYRW7t8UaGMyMXz2HiH7YoV2cQ=
|
||||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
@ -139,11 +139,12 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
|||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
go.uber.org/goleak v0.10.0 h1:G3eWbSNIskeRqtsN/1uI5B+eP73y3JUuBsv9AZjehb4=
|
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||||
go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI=
|
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
|
||||||
|
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
@ -152,7 +153,9 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL
|
|||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
|
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
@ -167,6 +170,7 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/
|
|||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
|
||||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
@ -178,6 +182,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
|||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -196,7 +201,9 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
|
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40 h1:JWgyZ1qgdTaF3N3oxC+MdTV7qvEEgHo3otj+HB5CM7Q=
|
||||||
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
@ -214,6 +221,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
|
|||||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
@ -241,6 +249,7 @@ google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/l
|
|||||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||||
|
@ -109,6 +109,7 @@ func (s *Semaphore) Close() error {
|
|||||||
return s.rc.Close()
|
return s.rc.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: change this
|
||||||
func semaphoreKey(scope string) string {
|
func semaphoreKey(scope string) string {
|
||||||
return fmt.Sprintf("asynq:sema:%s", scope)
|
return fmt.Sprintf("asynq:sema:%s", scope)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user