mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-19 21:27:42 +08:00
Refactor redis keys and store messages in protobuf
Changes: - Task messages are stored under "asynq:{<qname>}:t:<task_id>" key in redis, value is a HASH type and message are stored under "msg" key in the hash. The hash also stores "deadline", "timeout". - Redis LIST and ZSET stores task message IDs - Task messages are serialized using protocol buffer
This commit is contained in:
@@ -150,6 +150,17 @@ func TestEnqueueUnique(t *testing.T) {
|
||||
tc.msg, tc.ttl, err)
|
||||
continue
|
||||
}
|
||||
gotPending := h.GetPendingMessages(t, r.client, tc.msg.Queue)
|
||||
if len(gotPending) != 1 {
|
||||
t.Errorf("%q has length %d, want 1", base.PendingKey(tc.msg.Queue), len(gotPending))
|
||||
continue
|
||||
}
|
||||
if diff := cmp.Diff(tc.msg, gotPending[0]); diff != "" {
|
||||
t.Errorf("persisted data differed from the original input (-want, +got)\n%s", diff)
|
||||
}
|
||||
if !r.client.SIsMember(base.AllQueues, tc.msg.Queue).Val() {
|
||||
t.Errorf("%q is not a member of SET %q", tc.msg.Queue, base.AllQueues)
|
||||
}
|
||||
|
||||
// Check Pending list has task ID.
|
||||
pendingKey := base.PendingKey(tc.msg.Queue)
|
||||
|
Reference in New Issue
Block a user