2
0
mirror of https://github.com/hibiken/asynq.git synced 2026-07-13 10:26:01 +08:00

Rename (*rdb).push to enqueue

This commit is contained in:
Ken Hibino
2019-11-25 19:58:24 -08:00
parent 737de898eb
commit faa9b6ee22
3 changed files with 8 additions and 7 deletions

7
rdb.go
View File

@@ -37,8 +37,9 @@ func newRDB(client *redis.Client) *rdb {
return &rdb{client}
}
// push enqueues the task to queue.
func (r *rdb) push(msg *taskMessage) error {
// enqueue inserts the given task to the end of the queue.
// It also adds the queue name to the "all-queues" list.
func (r *rdb) enqueue(msg *taskMessage) error {
bytes, err := json.Marshal(msg)
if err != nil {
return fmt.Errorf("could not encode task into JSON: %v", err)
@@ -130,7 +131,7 @@ func (r *rdb) move(from string, msg *taskMessage) error {
return errSerializeTask
}
if r.client.ZRem(from, string(bytes)).Val() > 0 {
err = r.push(msg)
err = r.enqueue(msg)
if err != nil {
log.Printf("[SERVERE ERROR] could not push task to queue %q: %v\n",
msg.Queue, err)