Add ID field to taskMessage

This commit is contained in:
Ken Hibino
2019-11-22 06:16:43 -08:00
parent 67a9e8aa00
commit 80f477212d
3 changed files with 14 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"time"
"github.com/go-redis/redis/v7"
"github.com/google/uuid"
)
// Client is an interface for scheduling tasks.
@@ -20,6 +21,7 @@ func NewClient(opt *RedisOpt) *Client {
// Process enqueues the task to be performed at a given time.
func (c *Client) Process(task *Task, executeAt time.Time) error {
msg := &taskMessage{
ID: uuid.New(),
Type: task.Type,
Payload: task.Payload,
Queue: "default",