2020-01-03 10:13:16 +08:00
|
|
|
// Copyright 2020 Kentaro Hibino. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT license
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
2019-12-29 12:12:14 +08:00
|
|
|
// Package asynqtest defines test helpers for asynq and its internal packages.
|
|
|
|
package asynqtest
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"sort"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/go-redis/redis/v7"
|
|
|
|
"github.com/google/go-cmp/cmp"
|
2019-12-30 01:41:00 +08:00
|
|
|
"github.com/google/go-cmp/cmp/cmpopts"
|
2020-07-02 21:21:20 +08:00
|
|
|
"github.com/google/uuid"
|
2019-12-29 12:12:14 +08:00
|
|
|
"github.com/hibiken/asynq/internal/base"
|
|
|
|
)
|
|
|
|
|
|
|
|
// SortMsgOpt is a cmp.Option to sort base.TaskMessage for comparing slice of task messages.
|
|
|
|
var SortMsgOpt = cmp.Transformer("SortTaskMessages", func(in []*base.TaskMessage) []*base.TaskMessage {
|
|
|
|
out := append([]*base.TaskMessage(nil), in...) // Copy input to avoid mutating it
|
|
|
|
sort.Slice(out, func(i, j int) bool {
|
|
|
|
return out[i].ID.String() < out[j].ID.String()
|
|
|
|
})
|
|
|
|
return out
|
|
|
|
})
|
|
|
|
|
|
|
|
// SortZSetEntryOpt is an cmp.Option to sort ZSetEntry for comparing slice of zset entries.
|
2020-07-13 21:29:41 +08:00
|
|
|
var SortZSetEntryOpt = cmp.Transformer("SortZSetEntries", func(in []base.Z) []base.Z {
|
|
|
|
out := append([]base.Z(nil), in...) // Copy input to avoid mutating it
|
2019-12-29 12:12:14 +08:00
|
|
|
sort.Slice(out, func(i, j int) bool {
|
2020-07-13 21:29:41 +08:00
|
|
|
return out[i].Message.ID.String() < out[j].Message.ID.String()
|
2019-12-29 12:12:14 +08:00
|
|
|
})
|
|
|
|
return out
|
|
|
|
})
|
|
|
|
|
2020-04-13 07:42:11 +08:00
|
|
|
// SortServerInfoOpt is a cmp.Option to sort base.ServerInfo for comparing slice of process info.
|
|
|
|
var SortServerInfoOpt = cmp.Transformer("SortServerInfo", func(in []*base.ServerInfo) []*base.ServerInfo {
|
|
|
|
out := append([]*base.ServerInfo(nil), in...) // Copy input to avoid mutating it
|
2020-02-02 14:22:48 +08:00
|
|
|
sort.Slice(out, func(i, j int) bool {
|
|
|
|
if out[i].Host != out[j].Host {
|
|
|
|
return out[i].Host < out[j].Host
|
|
|
|
}
|
|
|
|
return out[i].PID < out[j].PID
|
|
|
|
})
|
|
|
|
return out
|
|
|
|
})
|
|
|
|
|
2020-02-23 12:42:53 +08:00
|
|
|
// SortWorkerInfoOpt is a cmp.Option to sort base.WorkerInfo for comparing slice of worker info.
|
|
|
|
var SortWorkerInfoOpt = cmp.Transformer("SortWorkerInfo", func(in []*base.WorkerInfo) []*base.WorkerInfo {
|
|
|
|
out := append([]*base.WorkerInfo(nil), in...) // Copy input to avoid mutating it
|
|
|
|
sort.Slice(out, func(i, j int) bool {
|
2020-05-19 11:47:35 +08:00
|
|
|
return out[i].ID < out[j].ID
|
2020-02-23 12:42:53 +08:00
|
|
|
})
|
|
|
|
return out
|
|
|
|
})
|
|
|
|
|
2020-02-23 06:30:24 +08:00
|
|
|
// SortStringSliceOpt is a cmp.Option to sort string slice.
|
|
|
|
var SortStringSliceOpt = cmp.Transformer("SortStringSlice", func(in []string) []string {
|
|
|
|
out := append([]string(nil), in...)
|
|
|
|
sort.Strings(out)
|
|
|
|
return out
|
|
|
|
})
|
|
|
|
|
2019-12-30 01:41:00 +08:00
|
|
|
// IgnoreIDOpt is an cmp.Option to ignore ID field in task messages when comparing.
|
|
|
|
var IgnoreIDOpt = cmpopts.IgnoreFields(base.TaskMessage{}, "ID")
|
|
|
|
|
2019-12-29 12:12:14 +08:00
|
|
|
// NewTaskMessage returns a new instance of TaskMessage given a task type and payload.
|
|
|
|
func NewTaskMessage(taskType string, payload map[string]interface{}) *base.TaskMessage {
|
2020-08-19 12:21:05 +08:00
|
|
|
return NewTaskMessageWithQueue(taskType, payload, base.DefaultQueueName)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewTaskMessageWithQueue returns a new instance of TaskMessage given a
|
|
|
|
// task type, payload and queue name.
|
|
|
|
func NewTaskMessageWithQueue(taskType string, payload map[string]interface{}, qname string) *base.TaskMessage {
|
2019-12-29 12:12:14 +08:00
|
|
|
return &base.TaskMessage{
|
2020-07-02 21:21:20 +08:00
|
|
|
ID: uuid.New(),
|
2020-06-17 12:11:54 +08:00
|
|
|
Type: taskType,
|
2020-08-19 12:21:05 +08:00
|
|
|
Queue: qname,
|
2020-06-17 12:11:54 +08:00
|
|
|
Retry: 25,
|
|
|
|
Payload: payload,
|
|
|
|
Timeout: 1800, // default timeout of 30 mins
|
|
|
|
Deadline: 0, // no deadline
|
2020-01-10 22:56:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-21 22:05:57 +08:00
|
|
|
// TaskMessageAfterRetry returns an updated copy of t after retry.
|
|
|
|
// It increments retry count and sets the error message.
|
|
|
|
func TaskMessageAfterRetry(t base.TaskMessage, errMsg string) *base.TaskMessage {
|
|
|
|
t.Retried = t.Retried + 1
|
|
|
|
t.ErrorMsg = errMsg
|
|
|
|
return &t
|
|
|
|
}
|
|
|
|
|
|
|
|
// TaskMessageWithError returns an updated copy of t with the given error message.
|
|
|
|
func TaskMessageWithError(t base.TaskMessage, errMsg string) *base.TaskMessage {
|
|
|
|
t.ErrorMsg = errMsg
|
|
|
|
return &t
|
|
|
|
}
|
|
|
|
|
2019-12-29 12:12:14 +08:00
|
|
|
// MustMarshal marshals given task message and returns a json string.
|
|
|
|
// Calling test will fail if marshaling errors out.
|
2019-12-31 12:10:34 +08:00
|
|
|
func MustMarshal(tb testing.TB, msg *base.TaskMessage) string {
|
|
|
|
tb.Helper()
|
2019-12-29 12:12:14 +08:00
|
|
|
data, err := json.Marshal(msg)
|
|
|
|
if err != nil {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Fatal(err)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
return string(data)
|
|
|
|
}
|
|
|
|
|
|
|
|
// MustUnmarshal unmarshals given string into task message struct.
|
|
|
|
// Calling test will fail if unmarshaling errors out.
|
2019-12-31 12:10:34 +08:00
|
|
|
func MustUnmarshal(tb testing.TB, data string) *base.TaskMessage {
|
|
|
|
tb.Helper()
|
2019-12-29 12:12:14 +08:00
|
|
|
var msg base.TaskMessage
|
|
|
|
err := json.Unmarshal([]byte(data), &msg)
|
|
|
|
if err != nil {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Fatal(err)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
return &msg
|
|
|
|
}
|
|
|
|
|
|
|
|
// MustMarshalSlice marshals a slice of task messages and return a slice of
|
|
|
|
// json strings. Calling test will fail if marshaling errors out.
|
2019-12-31 12:10:34 +08:00
|
|
|
func MustMarshalSlice(tb testing.TB, msgs []*base.TaskMessage) []string {
|
|
|
|
tb.Helper()
|
2019-12-29 12:12:14 +08:00
|
|
|
var data []string
|
|
|
|
for _, m := range msgs {
|
2019-12-31 12:10:34 +08:00
|
|
|
data = append(data, MustMarshal(tb, m))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
return data
|
|
|
|
}
|
|
|
|
|
|
|
|
// MustUnmarshalSlice unmarshals a slice of strings into a slice of task message structs.
|
|
|
|
// Calling test will fail if marshaling errors out.
|
2019-12-31 12:10:34 +08:00
|
|
|
func MustUnmarshalSlice(tb testing.TB, data []string) []*base.TaskMessage {
|
|
|
|
tb.Helper()
|
2019-12-29 12:12:14 +08:00
|
|
|
var msgs []*base.TaskMessage
|
|
|
|
for _, s := range data {
|
2019-12-31 12:10:34 +08:00
|
|
|
msgs = append(msgs, MustUnmarshal(tb, s))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
return msgs
|
|
|
|
}
|
|
|
|
|
|
|
|
// FlushDB deletes all the keys of the currently selected DB.
|
2019-12-31 12:10:34 +08:00
|
|
|
func FlushDB(tb testing.TB, r *redis.Client) {
|
|
|
|
tb.Helper()
|
2019-12-29 12:12:14 +08:00
|
|
|
if err := r.FlushDB().Err(); err != nil {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Fatal(err)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-07 22:28:34 +08:00
|
|
|
// SeedEnqueuedQueue initializes the specified queue with the given messages.
|
2020-08-07 21:31:02 +08:00
|
|
|
func SeedEnqueuedQueue(tb testing.TB, r *redis.Client, msgs []*base.TaskMessage, qname string) {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
r.SAdd(base.AllQueues, qname)
|
|
|
|
seedRedisList(tb, r, base.QueueKey(qname), msgs)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// SeedInProgressQueue initializes the in-progress queue with the given messages.
|
2020-08-08 21:48:49 +08:00
|
|
|
func SeedInProgressQueue(tb testing.TB, r *redis.Client, msgs []*base.TaskMessage, qname string) {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-21 21:00:49 +08:00
|
|
|
r.SAdd(base.AllQueues, qname)
|
2020-08-08 21:48:49 +08:00
|
|
|
seedRedisList(tb, r, base.InProgressKey(qname), msgs)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// SeedScheduledQueue initializes the scheduled queue with the given messages.
|
2020-08-08 21:48:49 +08:00
|
|
|
func SeedScheduledQueue(tb testing.TB, r *redis.Client, entries []base.Z, qname string) {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-21 21:00:49 +08:00
|
|
|
r.SAdd(base.AllQueues, qname)
|
2020-08-08 21:48:49 +08:00
|
|
|
seedRedisZSet(tb, r, base.ScheduledKey(qname), entries)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// SeedRetryQueue initializes the retry queue with the given messages.
|
2020-08-08 21:48:49 +08:00
|
|
|
func SeedRetryQueue(tb testing.TB, r *redis.Client, entries []base.Z, qname string) {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-21 21:00:49 +08:00
|
|
|
r.SAdd(base.AllQueues, qname)
|
2020-08-08 21:48:49 +08:00
|
|
|
seedRedisZSet(tb, r, base.RetryKey(qname), entries)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// SeedDeadQueue initializes the dead queue with the given messages.
|
2020-08-08 21:48:49 +08:00
|
|
|
func SeedDeadQueue(tb testing.TB, r *redis.Client, entries []base.Z, qname string) {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-21 21:00:49 +08:00
|
|
|
r.SAdd(base.AllQueues, qname)
|
2020-08-08 21:48:49 +08:00
|
|
|
seedRedisZSet(tb, r, base.DeadKey(qname), entries)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-06-18 22:10:57 +08:00
|
|
|
// SeedDeadlines initializes the deadlines set with the given entries.
|
2020-08-08 21:48:49 +08:00
|
|
|
func SeedDeadlines(tb testing.TB, r *redis.Client, entries []base.Z, qname string) {
|
2020-06-18 22:10:57 +08:00
|
|
|
tb.Helper()
|
2020-08-21 21:00:49 +08:00
|
|
|
r.SAdd(base.AllQueues, qname)
|
2020-08-08 21:48:49 +08:00
|
|
|
seedRedisZSet(tb, r, base.DeadlinesKey(qname), entries)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SeedAllEnqueuedQueues initializes all of the specified queues with the given messages.
|
|
|
|
//
|
|
|
|
// enqueued maps a queue name to a list of messages.
|
|
|
|
func SeedAllEnqueuedQueues(tb testing.TB, r *redis.Client, enqueued map[string][]*base.TaskMessage) {
|
|
|
|
for q, msgs := range enqueued {
|
|
|
|
SeedEnqueuedQueue(tb, r, msgs, q)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SeedAllInProgressQueues initializes all of the specified in-progress queues with the given messages.
|
|
|
|
func SeedAllInProgressQueues(tb testing.TB, r *redis.Client, inprogress map[string][]*base.TaskMessage) {
|
|
|
|
for q, msgs := range inprogress {
|
|
|
|
SeedInProgressQueue(tb, r, msgs, q)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SeedAllScheduledQueues initializes all of the specified scheduled queues with the given entries.
|
|
|
|
func SeedAllScheduledQueues(tb testing.TB, r *redis.Client, scheduled map[string][]base.Z) {
|
|
|
|
for q, entries := range scheduled {
|
|
|
|
SeedScheduledQueue(tb, r, entries, q)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SeedAllRetryQueues initializes all of the specified retry queues with the given entries.
|
|
|
|
func SeedAllRetryQueues(tb testing.TB, r *redis.Client, retry map[string][]base.Z) {
|
|
|
|
for q, entries := range retry {
|
|
|
|
SeedRetryQueue(tb, r, entries, q)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SeedAllDeadQueues initializes all of the specified dead queues with the given entries.
|
|
|
|
func SeedAllDeadQueues(tb testing.TB, r *redis.Client, dead map[string][]base.Z) {
|
|
|
|
for q, entries := range dead {
|
|
|
|
SeedDeadQueue(tb, r, entries, q)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SeedAllDeadlines initializes all of the deadlines with the given entries.
|
|
|
|
func SeedAllDeadlines(tb testing.TB, r *redis.Client, deadlines map[string][]base.Z) {
|
|
|
|
for q, entries := range deadlines {
|
|
|
|
SeedDeadlines(tb, r, entries, q)
|
|
|
|
}
|
2020-06-18 22:10:57 +08:00
|
|
|
}
|
|
|
|
|
2019-12-31 12:10:34 +08:00
|
|
|
func seedRedisList(tb testing.TB, c *redis.Client, key string, msgs []*base.TaskMessage) {
|
|
|
|
data := MustMarshalSlice(tb, msgs)
|
2019-12-29 12:12:14 +08:00
|
|
|
for _, s := range data {
|
|
|
|
if err := c.LPush(key, s).Err(); err != nil {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Fatal(err)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-13 21:29:41 +08:00
|
|
|
func seedRedisZSet(tb testing.TB, c *redis.Client, key string, items []base.Z) {
|
2019-12-29 12:12:14 +08:00
|
|
|
for _, item := range items {
|
2020-07-13 21:29:41 +08:00
|
|
|
z := &redis.Z{Member: MustMarshal(tb, item.Message), Score: float64(item.Score)}
|
2019-12-29 12:12:14 +08:00
|
|
|
if err := c.ZAdd(key, z).Err(); err != nil {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Fatal(err)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetEnqueuedMessages returns all enqueued messages in the given queue.
|
|
|
|
func GetEnqueuedMessages(tb testing.TB, r *redis.Client, qname string) []*base.TaskMessage {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getListMessages(tb, r, base.QueueKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetInProgressMessages returns all in-progress messages in the given queue.
|
|
|
|
func GetInProgressMessages(tb testing.TB, r *redis.Client, qname string) []*base.TaskMessage {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getListMessages(tb, r, base.InProgressKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetScheduledMessages returns all scheduled task messages in the given queue.
|
|
|
|
func GetScheduledMessages(tb testing.TB, r *redis.Client, qname string) []*base.TaskMessage {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetMessages(tb, r, base.ScheduledKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetRetryMessages returns all retry messages in the given queue.
|
|
|
|
func GetRetryMessages(tb testing.TB, r *redis.Client, qname string) []*base.TaskMessage {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetMessages(tb, r, base.RetryKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetDeadMessages returns all dead messages in the given queue.
|
|
|
|
func GetDeadMessages(tb testing.TB, r *redis.Client, qname string) []*base.TaskMessage {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetMessages(tb, r, base.DeadKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetScheduledEntries returns all scheduled messages and its score in the given queue.
|
|
|
|
func GetScheduledEntries(tb testing.TB, r *redis.Client, qname string) []base.Z {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetEntries(tb, r, base.ScheduledKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetRetryEntries returns all retry messages and its score in the given queue.
|
|
|
|
func GetRetryEntries(tb testing.TB, r *redis.Client, qname string) []base.Z {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetEntries(tb, r, base.RetryKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetDeadEntries returns all dead messages and its score in the given queue.
|
|
|
|
func GetDeadEntries(tb testing.TB, r *redis.Client, qname string) []base.Z {
|
2019-12-31 12:10:34 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetEntries(tb, r, base.DeadKey(qname))
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-08-07 21:31:02 +08:00
|
|
|
// GetDeadlinesEntries returns all task messages and its score in the deadlines set for the given queue.
|
|
|
|
func GetDeadlinesEntries(tb testing.TB, r *redis.Client, qname string) []base.Z {
|
2020-06-17 21:46:54 +08:00
|
|
|
tb.Helper()
|
2020-08-07 21:31:02 +08:00
|
|
|
return getZSetEntries(tb, r, base.DeadlinesKey(qname))
|
2020-06-17 21:46:54 +08:00
|
|
|
}
|
|
|
|
|
2019-12-31 12:10:34 +08:00
|
|
|
func getListMessages(tb testing.TB, r *redis.Client, list string) []*base.TaskMessage {
|
2019-12-29 12:12:14 +08:00
|
|
|
data := r.LRange(list, 0, -1).Val()
|
2019-12-31 12:10:34 +08:00
|
|
|
return MustUnmarshalSlice(tb, data)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2019-12-31 12:10:34 +08:00
|
|
|
func getZSetMessages(tb testing.TB, r *redis.Client, zset string) []*base.TaskMessage {
|
2019-12-29 12:12:14 +08:00
|
|
|
data := r.ZRange(zset, 0, -1).Val()
|
2019-12-31 12:10:34 +08:00
|
|
|
return MustUnmarshalSlice(tb, data)
|
2019-12-29 12:12:14 +08:00
|
|
|
}
|
|
|
|
|
2020-07-13 21:29:41 +08:00
|
|
|
func getZSetEntries(tb testing.TB, r *redis.Client, zset string) []base.Z {
|
2019-12-29 12:12:14 +08:00
|
|
|
data := r.ZRangeWithScores(zset, 0, -1).Val()
|
2020-07-13 21:29:41 +08:00
|
|
|
var entries []base.Z
|
2019-12-29 12:12:14 +08:00
|
|
|
for _, z := range data {
|
2020-07-13 21:29:41 +08:00
|
|
|
entries = append(entries, base.Z{
|
|
|
|
Message: MustUnmarshal(tb, z.Member.(string)),
|
|
|
|
Score: int64(z.Score),
|
2019-12-29 12:12:14 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
return entries
|
|
|
|
}
|